From d8aaf83b90352a58914ccbc4dec8fb1237994b3d Mon Sep 17 00:00:00 2001 From: Yoshito Umaoka Date: Thu, 25 Feb 2010 16:46:38 +0000 Subject: [PATCH] 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 --- icu4c/source/test/intltest/dtfmtrtts.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/icu4c/source/test/intltest/dtfmtrtts.cpp b/icu4c/source/test/intltest/dtfmtrtts.cpp index f3c4b84cb06..865ce70c906 100644 --- a/icu4c/source/test/intltest/dtfmtrtts.cpp +++ b/icu4c/source/test/intltest/dtfmtrtts.cpp @@ -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; + } } }