@Test public void roundSeconds1() { TimeScales.TimePeriod period = TimeScales.toTimePeriod(30.0); assertThat(period, equalTo(new TimePeriod(SECOND, 30.0))); }
static TimePeriod toTimePeriod(double seconds) { if ( seconds >= 36288000 ) { return new TimePeriod( GregorianCalendar.YEAR , seconds/3024000 ); } if ( seconds >= 3024000 ) { return new TimePeriod( GregorianCalendar.MONTH , seconds/3024000 ); } if ( seconds >= 604800 ) { return new TimePeriod( WEEK_FIELD_ID , seconds/604800.0 ); } if ( seconds >= 86400 ) { return new TimePeriod( DAY_FIELD_ID , seconds/86400.0 ); } if ( seconds >= 3600 ) { return new TimePeriod( HOUR_FIELD_ID , seconds/3600.0 ); } if (seconds >= 60) { return new TimePeriod(GregorianCalendar.MINUTE, seconds / 60.0); } if (seconds >= 1) { return new TimePeriod(GregorianCalendar.SECOND, seconds); } return new TimePeriod(GregorianCalendar.MILLISECOND, 1000*seconds); }
TimeScales { static TimePeriod toTimePeriod(double seconds) { if ( seconds >= 36288000 ) { return new TimePeriod( GregorianCalendar.YEAR , seconds/3024000 ); } if ( seconds >= 3024000 ) { return new TimePeriod( GregorianCalendar.MONTH , seconds/3024000 ); } if ( seconds >= 604800 ) { return new TimePeriod( WEEK_FIELD_ID , seconds/604800.0 ); } if ( seconds >= 86400 ) { return new TimePeriod( DAY_FIELD_ID , seconds/86400.0 ); } if ( seconds >= 3600 ) { return new TimePeriod( HOUR_FIELD_ID , seconds/3600.0 ); } if (seconds >= 60) { return new TimePeriod(GregorianCalendar.MINUTE, seconds / 60.0); } if (seconds >= 1) { return new TimePeriod(GregorianCalendar.SECOND, seconds); } return new TimePeriod(GregorianCalendar.MILLISECOND, 1000*seconds); } }
TimeScales { static TimePeriod toTimePeriod(double seconds) { if ( seconds >= 36288000 ) { return new TimePeriod( GregorianCalendar.YEAR , seconds/3024000 ); } if ( seconds >= 3024000 ) { return new TimePeriod( GregorianCalendar.MONTH , seconds/3024000 ); } if ( seconds >= 604800 ) { return new TimePeriod( WEEK_FIELD_ID , seconds/604800.0 ); } if ( seconds >= 86400 ) { return new TimePeriod( DAY_FIELD_ID , seconds/86400.0 ); } if ( seconds >= 3600 ) { return new TimePeriod( HOUR_FIELD_ID , seconds/3600.0 ); } if (seconds >= 60) { return new TimePeriod(GregorianCalendar.MINUTE, seconds / 60.0); } if (seconds >= 1) { return new TimePeriod(GregorianCalendar.SECOND, seconds); } return new TimePeriod(GregorianCalendar.MILLISECOND, 1000*seconds); }  }
TimeScales { static TimePeriod toTimePeriod(double seconds) { if ( seconds >= 36288000 ) { return new TimePeriod( GregorianCalendar.YEAR , seconds/3024000 ); } if ( seconds >= 3024000 ) { return new TimePeriod( GregorianCalendar.MONTH , seconds/3024000 ); } if ( seconds >= 604800 ) { return new TimePeriod( WEEK_FIELD_ID , seconds/604800.0 ); } if ( seconds >= 86400 ) { return new TimePeriod( DAY_FIELD_ID , seconds/86400.0 ); } if ( seconds >= 3600 ) { return new TimePeriod( HOUR_FIELD_ID , seconds/3600.0 ); } if (seconds >= 60) { return new TimePeriod(GregorianCalendar.MINUTE, seconds / 60.0); } if (seconds >= 1) { return new TimePeriod(GregorianCalendar.SECOND, seconds); } return new TimePeriod(GregorianCalendar.MILLISECOND, 1000*seconds); }  static TimeScale linearAbsoluteScale(); }
TimeScales { static TimePeriod toTimePeriod(double seconds) { if ( seconds >= 36288000 ) { return new TimePeriod( GregorianCalendar.YEAR , seconds/3024000 ); } if ( seconds >= 3024000 ) { return new TimePeriod( GregorianCalendar.MONTH , seconds/3024000 ); } if ( seconds >= 604800 ) { return new TimePeriod( WEEK_FIELD_ID , seconds/604800.0 ); } if ( seconds >= 86400 ) { return new TimePeriod( DAY_FIELD_ID , seconds/86400.0 ); } if ( seconds >= 3600 ) { return new TimePeriod( HOUR_FIELD_ID , seconds/3600.0 ); } if (seconds >= 60) { return new TimePeriod(GregorianCalendar.MINUTE, seconds / 60.0); } if (seconds >= 1) { return new TimePeriod(GregorianCalendar.SECOND, seconds); } return new TimePeriod(GregorianCalendar.MILLISECOND, 1000*seconds); }  static TimeScale linearAbsoluteScale(); final static int HOUR_FIELD_ID; final static int FIRST_HOUR; final static int DAY_FIELD_ID; final static int FIRST_DAY; final static int WEEK_FIELD_ID; final static int FIRST_WEEK; }