public static final Duration getDuration ( double value , TimeUnit type ) { double duration ; // Value is given in 1/10 of minute switch ( type ) { case MINUTES : case ELAPSED_MINUTES : { duration = value / 10 ; break ; } case HOURS : case ELAPSED_HOURS : { duration = value / 600 ; // 60 * 10 break ; } case DAYS : { duration = value / 4800 ; // 8 * 60 * 10 break ; } case ELAPSED_DAYS : { duration = value / 14400 ; // 24 * 60 * 10 break ; } case WEEKS : { duration = value / 24000 ; // 5 * 8 * 60 * 10 break ; } case ELAPSED_WEEKS : { duration = value / 100800 ; // 7 * 24 * 60 * 10 break ; } case MONTHS : { duration = value / 96000 ; // 4 * 5 * 8 * 60 * 10 break ; } case ELAPSED_MONTHS : { duration = value / 432000 ; // 30 * 24 * 60 * 10 break ; } default : { duration = value ; break ; } } return ( Duration . getInstance ( duration , type ) ) ; }
Reads a duration value . This method relies on the fact that the units of the duration have been specified elsewhere .