Time zone: the next generation
eggert at CS.UCLA.EDU
Mon Mar 7 19:47:13 UTC 2005
Robert Elz <kre at munnari.oz.au> writes:
> What exactly si required for POSIX conformance? Do they require that
> we get DST conversions correct (for everywhere on the planet) for
> all years that are representable as an int?
Yes, but not "for everywhere on the planet"; it's simply for every DST
rule expressible as a POSIX TZ string. POSIX TZ strings can represent
just one DST rule (e.g., the current US rules), and the set of rules
is rather limited (e.g., they cannot represent the Israeli or Iranian
rules). And yes, it is a bit of absurd requirement, but it is there,
and I wouldn't be surprised if some test suites check for it.
> | > Backwards, 1970 is far enough to be accurate.
> | Here I think you're being a bit too modest in aim. The existing code
> | already works for dates back to 1901 (in 32-bit time_t),
> Does it really? For all timezones, for all DST rules?
Yes. I use it regularly to test time zone data before 1970. It's
supposed to work, anyway, and when I find bugs (which is pretty rare
these days) they get fixed.
> I doubt that we get to decide what a time_t format should be
> in fact, some of the recent changes to the code are there precisely
> because we don't get to make that decision (if we did, we wouldn't
> be bothering with that floating point nonsense).
Yes, but the main point is that the code should work well with signed
64-bit time_t, which is the #2 most-popular format in practice, and
whose popularity is gaining with time.
> I think it would be just plain crazy to express people's date of birth
> as a time_t... And who cares anyway?)
The most-important users are astrologers, and (I suppose) scientists
who occasionally debunk astrologers' claims.
> And which records that retain DoB information, also bother to record the
> timezone that applied at the place of birth, so the correct DST conversions
> can be done on it?
Users infer the time zone from the location and the recorded time on
the records. They can be very serious about this sort of thing. For
example, if you were born in 1950 in Japan, they care whether you were
born in a US military hospital or a Japanese hospital, as different
time zones were used. (At least, this is what I've been told -- I
don't have hard evidence for it.)
I do agree that to some extent this whole thing is overkill; but the
tz database is already overkill to some extent, and we might as well
find a sweet spot in how much overkill we're willing to do. It's not
much extra work to support time stamps before 1970, and there is some
utility to doing so, so I don't see why not.
More information about the tz