use of java.util.GregorianCalendar in project j2objc by google.
the class CalendarTest method testAddTwoDaysOver30MinuteDstForwardAdds47AndAHalfHours.
public void testAddTwoDaysOver30MinuteDstForwardAdds47AndAHalfHours() {
Calendar calendar = new GregorianCalendar(AUSTRALIA_LORD_HOWE);
// 02:10 GMT+10:30
calendar.set(2011, 9, 1, 2, 10);
double hoursSinceEpoch = hoursSinceEpoch(calendar);
calendar.add(Calendar.DATE, 2);
assertEquals(47.5, hoursSinceEpoch(calendar) - hoursSinceEpoch);
// 02:10 GMT+11:00; +47.5 hours
assertCalendarEquals(calendar, 2011, 9, 3, 2, 10);
}
use of java.util.GregorianCalendar in project j2objc by google.
the class CalendarTest method testAddOneDayOverDstForwardAdds24HoursAt0000.
/**
* At their daylight savings time switch, Sao Paulo changes from
* "00:00 GMT-3" to "01:00 GMT-2". When adding time across this boundary,
* drop an hour to keep the hour+minute constant unless that prevents the
* date field from being incremented.
* http://code.google.com/p/android/issues/detail?id=17502
*/
public void testAddOneDayOverDstForwardAdds24HoursAt0000() {
Calendar calendar = new GregorianCalendar(AMERICA_SAO_PAULO);
// 00:00 GMT-3
calendar.set(2011, 9, 15, 0, 0);
double hoursSinceEpoch = hoursSinceEpoch(calendar);
calendar.add(Calendar.DATE, 1);
assertEquals(24.0, hoursSinceEpoch(calendar) - hoursSinceEpoch);
// 01:00 GMT-2; +24 hours
assertCalendarEquals(calendar, 2011, 9, 16, 1, 0);
}
use of java.util.GregorianCalendar in project j2objc by google.
the class CalendarTest method testAddOneDayOverDstForwardAdds23HoursAt0100.
public void testAddOneDayOverDstForwardAdds23HoursAt0100() {
Calendar calendar = new GregorianCalendar(AMERICA_SAO_PAULO);
// 01:00 GMT-3
calendar.set(2011, 9, 15, 1, 0);
double hoursSinceEpoch = hoursSinceEpoch(calendar);
calendar.add(Calendar.DATE, 1);
assertEquals(23.0, hoursSinceEpoch(calendar) - hoursSinceEpoch);
// 01:00 GMT-2; +23 hours
assertCalendarEquals(calendar, 2011, 9, 16, 1, 0);
}
use of java.util.GregorianCalendar in project j2objc by google.
the class CalendarTest method test_clear_45877_morning.
// https://code.google.com/p/android/issues/detail?id=45877
public void test_clear_45877_morning() {
GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("America/Los_Angeles"));
// 3rd February 2016 05:32:40.000 America/Los_Angeles time.
cal.setTimeInMillis(1454506360000L);
checkClear(cal, 0, 28800000);
}
use of java.util.GregorianCalendar in project j2objc by google.
the class CalendarTest method testAdd24HoursOverDstForwardAdds24Hours.
public void testAdd24HoursOverDstForwardAdds24Hours() {
Calendar calendar = new GregorianCalendar(AMERICA_SAO_PAULO);
// 01:00 GMT-3
calendar.set(2011, 9, 15, 1, 0);
double hoursSinceEpoch = hoursSinceEpoch(calendar);
calendar.add(Calendar.HOUR, 24);
assertEquals(24.0, hoursSinceEpoch(calendar) - hoursSinceEpoch);
// 02:00 GMT-2; +24 hours
assertCalendarEquals(calendar, 2011, 9, 16, 2, 0);
}
Aggregations