use of org.joda.time.DateTimeZone in project SeriesGuide by UweTrottmann.
the class TimeToolsTest method test_parseEpisodeReleaseTime_Country.
@Test
public void test_parseEpisodeReleaseTime_Country() {
// ensure a German show has its local release time correctly converted to UTC time
// (we can be sure that in May there is always DST in effect in Europe/Berlin
// so this test will likely not break if DST rules change)
DateTimeZone showTimeZone = DateTimeZone.forID(EUROPE_BERLIN);
String deviceTimeZone = AMERICA_LOS_ANGELES;
long episodeReleaseTime = TimeTools.parseEpisodeReleaseDate(null, showTimeZone, "2013-05-31", // 20:00
new LocalTime(20, 0), GERMANY, null, deviceTimeZone);
System.out.println("Release time: " + episodeReleaseTime + " " + new Date(episodeReleaseTime));
assertThat(episodeReleaseTime).isEqualTo(1370023200000L);
}
use of org.joda.time.DateTimeZone in project SeriesGuide by UweTrottmann.
the class TimeToolsTest method test_parseEpisodeReleaseTime.
@Test
public void test_parseEpisodeReleaseTime() {
// ensure a US show has its local release time correctly converted to UTC time
// (we can be sure that in May there is always DST in effect in America/New_York
// so this test will likely not break if DST rules change)
DateTimeZone showTimeZone = DateTimeZone.forID(AMERICA_NEW_YORK);
String deviceTimeZone = AMERICA_LOS_ANGELES;
long episodeReleaseTime = TimeTools.parseEpisodeReleaseDate(null, showTimeZone, "2013-05-31", // 20:00
new LocalTime(20, 0), UNITED_STATES, null, deviceTimeZone);
System.out.println("Release time: " + episodeReleaseTime + " " + new Date(episodeReleaseTime));
assertThat(episodeReleaseTime).isEqualTo(1370055600000L);
}
use of org.joda.time.DateTimeZone in project SeriesGuide by UweTrottmann.
the class TimeToolsTest method test_parseEpisodeReleaseTime_NoHourPastMidnight.
@Test
public void test_parseEpisodeReleaseTime_NoHourPastMidnight() {
// ensure episodes releasing in the hour past midnight are NOT moved to the next day
// if it is a Netflix show
DateTimeZone showTimeZone = DateTimeZone.forID(AMERICA_NEW_YORK);
String deviceTimeZone = AMERICA_LOS_ANGELES;
long episodeReleaseTime = TimeTools.parseEpisodeReleaseDate(null, showTimeZone, // +one day here
"2013-06-01", // 00:35
new LocalTime(0, 35), UNITED_STATES, "Netflix", deviceTimeZone);
System.out.println("Release time: " + episodeReleaseTime + " " + new Date(episodeReleaseTime));
assertThat(episodeReleaseTime).isEqualTo(1370072100000L);
}
use of org.joda.time.DateTimeZone in project SeriesGuide by UweTrottmann.
the class TimeToolsTest method test_parseEpisodeReleaseTime_HourPastMidnight.
@Test
public void test_parseEpisodeReleaseTime_HourPastMidnight() {
// ensure episodes releasing in the hour past midnight are moved to the next day
// e.g. if 00:35, the episode date is typically (wrongly) that of the previous day
// this is common for late night shows, e.g. "Monday night" is technically "early Tuesday"
DateTimeZone showTimeZone = DateTimeZone.forID(AMERICA_NEW_YORK);
String deviceTimeZone = AMERICA_LOS_ANGELES;
long episodeReleaseTime = TimeTools.parseEpisodeReleaseDate(null, showTimeZone, "2013-05-31", // 00:35
new LocalTime(0, 35), UNITED_STATES, null, deviceTimeZone);
System.out.println("Release time: " + episodeReleaseTime + " " + new Date(episodeReleaseTime));
assertThat(episodeReleaseTime).isEqualTo(1370072100000L);
}
use of org.joda.time.DateTimeZone in project SeriesGuide by UweTrottmann.
the class TimeToolsTest method test_parseEpisodeReleaseTime_Country.
@Test
public void test_parseEpisodeReleaseTime_Country() {
// ensure a German show has its local release time correctly converted to UTC time
// (we can be sure that in May there is always DST in effect in Europe/Berlin
// so this test will likely not break if DST rules change)
DateTimeZone showTimeZone = DateTimeZone.forID(EUROPE_BERLIN);
String deviceTimeZone = AMERICA_LOS_ANGELES;
long episodeReleaseTime = TimeTools.parseEpisodeReleaseDate(null, showTimeZone, "2013-05-31", // 20:00
new LocalTime(20, 0), GERMANY, null, deviceTimeZone);
System.out.println("Release time: " + episodeReleaseTime + " " + new Date(episodeReleaseTime));
assertThat(episodeReleaseTime).isEqualTo(1370023200000L);
}
Aggregations