Design Docs‎ > ‎Formatting‎ > ‎TimeZone‎ > ‎getOffset‎ > ‎

Discussion 20071030: getOffset for ambiguous time range

getOffset for ambiguous time range
3 messages <>Tue, Oct 30, 2007 at 7:16 AM
To: Markus Scherer <>
Cc:,, Mark Davis <>
Hi Markus,

In ICU4J, I added an API - getOffsetFromLocale in BasicTimeZone (I'm still
thinkin where the method resides - may move it up to TimeZone) in my own

I initially thought that we just need one flag to control the behavior -
whether earlier iteration or later iteration.  Then I found a very odd
example - Daylight -> Standard, but positive offset change (because base
offset is changed at the same time).  For DateFormat parsing, we may
already know the local wall time is STD or DST.  In this case, we want to
use one of them even DST -> STD is a positive offset change.  To make the
API to cover all the cases, I had to implement two levels of flags - DST
or STD / former or latter.

When LOCAL_STD is set and the transition is either STD->DST or DST->STD,
it always interpret time as standard time, no matter
When LOCAL_FORMER is set and the transition is STD->STD or DST->DST, then
it always interpret time as former one.

I'm not sure the way of specifying these options are OK for public API..


Markus Scherer <>Wed, Nov 14, 2007 at 10:41 AM
Cc:,, Mark Davis <>
Hi Yoshito,

Sorry for the very late reply!

This sounds like it might be simpler to have an "enum" (simple "final
int"s in Java) with 4 values rather than two boolean or dual-choice

[Quoted text hidden] <>Wed, Nov 28, 2007 at 2:56 PM
To: Markus Scherer <>
Cc:, Mark Davis <>,
Hi Markus,

I got your point and I agree that we may want to simplify the options.

For this time, I already implemented like that way and had no time to
improve the options, I will go for the current implementation.
The API is marked as @internal because we cannot add any public APIs in
maintenance releases.  However, after once 3.8.1 is shipped, I will
revisit this and clean up the options.  For 4.0, I will post the updated
API proposal in the design list and make the API public (@draft 4.0).