Java Code Examples for org.joda.time.DateTime.minusSeconds()

The following are Jave code examples for showing how to use minusSeconds() of the org.joda.time.DateTime class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: unitimes   File: EventsExportEventsToICal.java   Source Code and License Vote up 6 votes
public ICalendarMeeting(MeetingInterface meeting, Status status) {
	if (meeting.getStartTime() != null) {
		iStart = new DateTime(meeting.getStartTime());
	} else {
		iStart = new DateTime(meeting.getMeetingDate()).plusMinutes((5 * meeting.getStartSlot()) + meeting.getStartOffset());
	}
	if (meeting.getStartTime() != null) {
		iEnd = new DateTime(meeting.getStopTime());
	} else {
		iEnd = new DateTime(meeting.getMeetingDate()).plusMinutes((5 * meeting.getEndSlot()) + meeting.getEndOffset());
	}
	if (iStart.getSecondOfMinute() != 0) iStart = iStart.minusSeconds(iStart.getSecondOfMinute());
	if (iEnd.getSecondOfMinute() != 0) iEnd = iEnd.minusSeconds(iEnd.getSecondOfMinute());
	if (iStart.getMillisOfSecond() != 0) iStart = iStart.minusMillis(iStart.getMillisOfSecond());
	if (iEnd.getMillisOfSecond() != 0) iEnd = iEnd.minusMillis(iEnd.getMillisOfSecond());
	iLocation = meeting.getLocationName(MESSAGES);
	iStatus = (status != null ? status : meeting.isApproved() ? Status.confirmed() : Status.tentative());
}
 
Example 2
Project: xsharing-services-router   File: RouteLegListTest.java   Source Code and License Vote up 3 votes
@Test
public void testArrival() {

    DateTime t1 = new DateTime(2016, 5, 24, 11, 0, DateTimeZone.UTC);

    RouteLegList routeLegList = new RouteLegList(t1, true);

    WalkingLeg walkingLeg1 = new WalkingLeg(LegType.WalkingLeg, geoCoord, geoCoord, distance, 50, sr, "");
    DateTime t2 = t1.minusSeconds(50);

    routeLegList.addAndShift(new RouteLegWrapper(walkingLeg1));
    System.out.println(routeLegList);

    CarLeg carLeg = new CarLeg(LegType.CarLeg, geoCoord, geoCoord, distance, 280, sr, "");
    DateTime t3 = t2.minusSeconds(280);

    Interval interval = routeLegList.getIntervalAfterPossibleLeg(carLeg.getDuration());
    System.out.println(interval);

    Assert.assertEquals(interval, new Interval(t3, t2));
    routeLegList.addAndShift(new RouteLegWrapper(carLeg));
    System.out.println(routeLegList);

    WalkingLeg walkingLeg2 = new WalkingLeg(LegType.WalkingLeg, geoCoord, geoCoord, distance, 90, sr, "");
    DateTime t4 = t3.minusSeconds(90);

    Interval interval2 = routeLegList.getIntervalAfterPossibleLeg(walkingLeg2.getDuration());
    System.out.println(interval2);

    Assert.assertEquals(interval2, new Interval(t4, t3));

    routeLegList.addAndShift(new RouteLegWrapper(walkingLeg2));
    System.out.println(routeLegList);
}