[Haskell-cafe] Re: Working with multiple time zones

Yitzchak Gale gale at sefer.org
Mon Feb 18 18:07:43 EST 2008

Brandon S. Allbery KF8NH wrote:
>> some platforms require tzset() to recognize timezone changes.

I think it is something like - POSIX requires the tzset()
call, but in ANSI C 98 there is no tzset() and localtime()
always rechecks TZ automatically. Right?

In the man page on Mac OS X Tiger (Darwin 8.11.1),
it says that localtime() calls tzset() automatically if
the current process has not called it yet. Which implies
that it would only be called once, so I don't understand
Bjorn's successful result on that platform.

Don Stewart wrote:
> Perhaps we should get a binding to tzset in the unix library?

I agree - but to make it worthwhile, we should either:

a) make things work the same on all platforms, or

b) faithfully expose the underlying local platform, but make it
   easy (and well documented) for a program to discover what
   needs to be done to make things work. (Even if the
   information provided by System.Info is sufficient, how easy
   is it to use it for this?)

In any case, full information or a clear pointer to it should
appear in the Haddocks for Data.Time.LocalTime, System.Time,
and wherever else appropriate.

For comparison, Python does (a) - the behavior of localtime()
and tzset() are always like POSIX, even on a platform that
does otherwise. And also on Windows. This behavior is
clearly described in the documentation for the time module.


More information about the Haskell-Cafe mailing list