Millisecond clock resolution for DateAndTime now

David T. Lewis lewis at mail.msen.com
Mon Sep 27 10:09:04 UTC 2004


On Sun, Sep 26, 2004 at 07:57:19PM -0700, Tim Rowledge wrote:
> "David T. Lewis" <lewis at mail.msen.com> wrote:
> 
> > media.  The world is a wobbly place, full of uncertainty and all manner
> > of imprecision.
> I demand that there be rigidly defined areas of doubt and uncertainty!
> (I hope you've all caught up with the new hitchhikers series recently
> started on www.bbc.co.uk.radio ?)

Why no, as a matter of fact. Thanks for the tip.

> [snip]
> > gmtime() has precision to the nearest second. Does RISC OS provide a
> > gettimeofday() function? This is a BSD function that answers time to
> > millisecond precision, and also provides the time zone offset and a
> > flag denoting daylight savings time. If this or something like it is
> > available on RISC OS, then it should be possible to implement Lex's
> > suggestion on all the major Squeak platforms.
> I expect I can come up with something close enough. If nothing else I
> can rip code out of the unixlib implementation.
> 
> Now here's a thought - do all OSs (any) successfully deal with those 22
> or so leap seconds?

I'm not entirely sure. The time zone database files contain the leap
second information, so it's likely that a Unix type system is using this
if you set the system time zone to the right setting. If you load the
TimeZoneDatabase from SqueakMap, and open an object inspector on the
time zone database, you can get a pretty good idea of how it works.

As an example, I'm in the Detroit area. If I use the "right/America/Detroit"
time zone rules, the leap second rules are used. However, if I use
the "America/Detroit" time zone, leap seconds are ignored.

> Are they algorithmic or declared by fiat? 

Time zones are declared by fiat by a haphazard collection of beady-eyed
bureaucrats, political operatives, and local school boards.

Leap seconds apply to all time zones. They are declared by fiat based
on the celestial observations of a small group of really smart people
who keep track of world wobblitude for the benefit of the rest of us.

Dave




More information about the Squeak-dev mailing list