Oh yeah, we may as well go with ANSI. The plugin is extremely easy to use--it returns a 10-element array, with 5 elements each for UTC and local date/time. Should one of us merge this stuff with your ANSI code? I'm not sure I have the right tools to mess with these changesets you have, but I'll update them if you point me in the right direction.
Note that we really do need a new time primitive; currently you can only get local time or UTC, and not both. Everybody's trick is to just stick the UTC offset in a global variable, but this approach doesn't work when either:
1. daylight savings kicks in. 2. an image gets shipped to somewhere in a different time zone.
-Lex
"R. A. Harmon" harmonra@webname.com wrote:
At 05:05 PM 6/28/00 -700, "lex spoon" lex@cc.gatech.edu wrote:
Here are a pair of changesets that let Squeak discern local vs. UTC time. It adds one primitive, which returns both the local time and UTC in parallel. Squeak-level code can then interpret this information as needed.
The first changeset defines the primitive and a plugin that implements it. It should be fairly portable, but I've only tried it on Linux. The second changeset updates the Time class to use the new plugin when its present, and it updates Celeste to make date stamps with it.
How does this look to people? It seems to allow the following basic time functions, with a minimum of fuss:
- Return a UTC time precise to the second. This is useful when
Squeak's are talking to each other from different places in the world. It's also precisely what's needed for building a proper HTTP cache.
- Return a local time precise to the second. This is useful for clock
and calender displays.
- Return a local time plus a delta from UTC. This is what email is
happiest with.
Is anything critical missing? What else would people like to be able to do with time? If this looks good, let's put it in the main system.
I think the ANSI Date And Time protocol messages should do the above. I've implemented in Squeak it along with all the ANSI messages except for Stream and FileStream protocols and maybe a couple Collection protocol messages.
I've reworked the Camp Smalltalk ANSI tests for Squeak released by Ralph E. Johnson for my ANSI implementation. The reworked version, ANSIChgSeta02r01Sqkv02r07.ZIP, containing Squeak ANSI messages, tests, and support is now available at my web page:
http://homepage2.rconnect.com/raharmon/
I think Squeak Central is looking at incorporating the ANSI messages in the standard release. I think it might be a more portable and easier route to use the ANSI messages for doing the time stuff above.
-- Richard A. Harmon "The only good zombie is a dead zombie" harmonra@webname.com E. G. McCarthy Spencer, Iowa
squeak-dev@lists.squeakfoundation.org