ICU-5624 Updated DateFormatRoundTripTest to support the case when the test date falls in the LMT era. Before 64bit time zone data support, PST uses -8:00 offset for dates before Nov 18, 1883.

X-SVN-Rev: 27675
This commit is contained in:
Yoshito Umaoka 2010-02-25 16:46:38 +00:00
parent d9908563d0
commit d8aaf83b90

View file

@ -381,10 +381,18 @@ void DateFormatRoundTripTest::test(DateFormat *fmt, const Locale &origLocale, UB
int maxSmatch = 1;
if (dmatch > maxDmatch) {
// Time-only pattern with zone information and a starting date in PST.
if(timeOnly && hasZoneDisplayName
&& fmt->getTimeZone().inDaylightTime(d[0], status) && ! failure(status, "TimeZone::inDST()")) {
maxDmatch = 3;
maxSmatch = 2;
if(timeOnly && hasZoneDisplayName) {
int32_t startRaw, startDst;
fmt->getTimeZone().getOffset(d[0], FALSE, startRaw, startDst, status);
failure(status, "TimeZone::getOffset");
// if the start offset is greater than the offset on Jan 1, 1970
// in PST, then need one more round trip. There are two cases
// fall into this category. The start date is 1) DST or
// 2) LMT (GMT-07:52:58).
if (startRaw + startDst > -28800000) {
maxDmatch = 3;
maxSmatch = 2;
}
}
}