Millisecond clock resolution for DateAndTime now
Tim Rowledge
tim at sumeru.stanford.edu
Sun Sep 26 19:30:59 UTC 2004
lex at cc.gatech.edu wrote:
> John M McIntosh <johnmci at smalltalkconsulting.com> wrote:
> > I guess one could lobby for
> > unix (tm) gettimeofday()
> > for 3.9
> > This could even be via a plugin, or FFI call...
>
> I agree. gettimeofday() can give you microsecond precision and timezone
> information.
>
> And while we're at it, how about adjusting the primitive's *interface*
> to ask for the UTC offset as well? The get-time primitive would then
> return two things:
>
> 1. The time, probably as approximately[1] the number of seconds since
> some epoch.
>
> 2. The offset in seconds to get to UTC time.
a) we can add a new primitive easily enough. Changing an old one is
dangerous
b) Why return munged up seconds when quite often the image code
immediately works backwards to derive the day/hour/year etc? Let's pass
the prim a sensible date/time object aand fill in the
year/day/hour/minute/second/mSec/flavour-of-the-day-icecream etc. No
need to worry about epoch stuff. Leave the OS to care about timezone,
DST.
tim
--
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
Modem: How a Southerner asks for seconds...
More information about the Squeak-dev
mailing list
|