[Haskell-cafe] Data.Time

Yitzchak Gale gale at sefer.org
Mon Jul 4 09:38:43 CEST 2011


I wrote:
>> Not exactly. A "TimeZone" in Data.Time doesn't really
>> represent a time zone - it represents a specific clock setting
>> in a time zone.

Ashley Yakeley wrote:
> I still regret this! I should have called it TimeOffset or somesuch.

Oh, it's not your fault. Every other time library in the world
calls that a "time zone". You've gotten so many other
more substantial things right that so many others got wrong.
This name is nothing to worry about.

>> To get a TimeZoneSeries, representing a time zone with
>> all of its known clock changes throughout history and some
>> years into the future, use the timezone-olson package[2] to
>> read an Olson time zone file. On Linux and Mac OS X
>> systems, Olson time zone files are available in the directory
>> /usr/share/zoneinfo.

> Leap second data is there too, so it should be possible to create a
> Data.Time.Clock.TAI.LeapSecondTable from it.

No, unfortunately. There is a place in the data structure
for leap second information, but no live Olson
file has every populated it AFAIK.

That's not so important though. There have been very
few leap seconds in history, and they occur rarely.
Their release cycle has been slower than the usual
release cycle of software packages. So this is something
that could easily be done manually.

> Also, it might be worth creating an OS-specific package
> that dealt with the filepaths for you, so for instance you
> could read in a TimeZoneSeries given
> a time zone name such as America/Los_Angeles.

That would be nice.

Perhaps a higher priority would be to add support for
Windows, where the Olson data is in the registry
rather than in the file system. Right now, people on
Windows are still dependent on asking a favor from
their friends to lend them copies of the latest Olson files.

Another important enhancement would be support
for POSIX rules. Olson files still supply explicit
clock changes for about two decades into the
future. But I believe that will gradually end now
that the new Olson file format supports
POSIX rules for clock changes beyond the
last one explicitly specified. (And besides being
supported, recently released Olson files actually do
contain the POSIX rules. So does the Windows
registry.)

Thanks,
Yitz



More information about the Haskell-Cafe mailing list