Java Code Examples for org.joda.time.Seconds#getSeconds()

The following examples show how to use org.joda.time.Seconds#getSeconds() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TimeConverter.java    From gocd with Apache License 2.0 5 votes vote down vote up
public ConvertedTime getConvertedTime(long duration) {
    Set<Seconds> keys = RULES.keySet();
    for (Seconds seconds : keys) {
        if (duration <= seconds.getSeconds()) {
            return RULES.get(seconds).getConvertedTime(duration);
        }
    }
    return new TimeConverter.OverTwoYears().getConvertedTime(duration);
}
 
Example 2
Source File: CucumberHooks.java    From NoraUi with GNU Affero General Public License v3.0 4 votes vote down vote up
protected static int getRemainingTime() {
    DateTime now = DateTime.now();
    Seconds pastTime = Seconds.secondsBetween(Context.getStartCurrentScenario(), now);
    int totalTimecalculated = pastTime.getSeconds() * Context.getDataInputProvider().getNbGherkinExample() / Context.getCurrentScenarioData();
    return totalTimecalculated - pastTime.getSeconds();
}
 
Example 3
Source File: SecondsBetweenDates.java    From levelup-java-examples with Apache License 2.0 3 votes vote down vote up
@Test
public void seconds_between_two_dates_in_java_with_joda () {

	// start day is 1 day in the past
	DateTime startDate = new DateTime().minusDays(1);
	DateTime endDate = new DateTime();
	
	Seconds seconds = Seconds.secondsBetween(startDate, endDate);
	
	int secondsInDay = seconds.getSeconds();
	
	assertEquals(86400, secondsInDay);
}