[FIX] Various fixes for Celeste

Eric Ulevik eau at fast.fujitsu.com.au
Wed Nov 24 07:41:15 UTC 1999


From: Tim Rowledge <rowledge at interval.com>
> > I keep hoping someone will jump up who understands time zones and
> > calendrial calculations and such and implement something in Squeak that
> > can be easily ported around.
> Oh my, that's a _lot_ to hope for! At PPS some years ago we had a
> multi-day mailstorm about timezone stuff that generated enough hot air
> to send Branson across the Atlantic. Conclusion: it's _damn_
> complicated. Basically you need a way to read the time and your
> machine's timezone, plus a way to convert from one TZ to another.
>
> The good news is that by now all the OS's we use have at least some
> understanding of timezones, where back then many didn't. I don't suppose
> there is a website that offers zone/time conversion ? It may well be
> simplest to pass the job off to a server somewhere.
> Some timezones have a partial hour offset.
> Some have wierd rules for daylight savings time start/stop.
> Some appear to have no 'rules' - IIRC, UK DST is set on a year by year
> basis.
> Some have many names.

I understand time zones and calendrical calculations in detail, but
unfortunately I can't find the time to implement it in Squeak (yet, anyway).

Some axioms for dealing with calendars:
* always perform calculations in number of days since epoch (usually Julian
day numbers)
* Calendars are algorithms which convert to and from day numbers
* Calendars extend over all day numbers
* text output is conversion from day number to calendar date
* text input is conversion from calendar date to day number
* Note: the date of year change has varied over time

Some axioms for dealing with time zones:
* a time zone is indentified by a city (and includes surrounding areas)
* a time zone is a collection of rules which convert between UTC and local
time
* rules can vary from year to year
* always perform all calculations in UTC (aka GMT)
* text output is a conversion from UTC to a given zone
* text input is a conversion from a given zone to UTC

Unix systems (and BeOS) handle time zones more-or-less OK. Microsoft Windows
only has one set of rules for all years, which means they often get the DST
start and end shifts wrong. I don't know about MacOS.

For the best up-to-date C code and data, see ftp://elsie.nci.nih.gov/pub/

A web interface is at http://www.bsdi.com/date/

A somewhat out-of-date but quite pretty map is at
http://www.odci.gov/cia/publications/factbook/figures/920649.pdf

Regards,

Eric Ulevik

ps. If this is all too easy, you can look at leap seconds.

Handling UT0, UT1 and UTC correctly would be impressive.





More information about the Squeak-dev mailing list