[squeak-dev] UTCDateAndTime updated for Squeak trunk Chronology and Spur (was: UTCDateAndTime updated for Squeak 4.6/5.0)

Eliot Miranda eliot.miranda at gmail.com
Fri Mar 25 16:47:43 UTC 2016


On Fri, Mar 25, 2016 at 9:23 AM, Bert Freudenberg <bert at freudenbergs.de>
wrote:

> On 25.03.2016, at 16:51, David T. Lewis <lewis at mail.msen.com> wrote:
> >
> > On Thu, Mar 24, 2016 at 10:05:17PM -0700, Eliot Miranda wrote:
> >> I see two or three system calls in the code below.  gettimeofday, one
> inside localtime and one inside gmtime.  That's expensive.
> >>
> >
> > It's gettimeofday() and localtime(). The #else is fallback for older
> unix platforms.
> >
> > In any case, caching the value and updating it periodically does not
> sound like a good idea to me.
>
> Well, it’s okay to cheat as long as you won’t get caught (says DI).
>
> Simply “once a second” is not good enough if we check the time 0.5 seconds
> after DST switch.
>
> If “once a second” was implemented as “once every wall-clock second”, IMHO
> that would be fine. So the test would have to be something like
>
>         (prevUsecs // 1000000) ~= (nowUsecs // 1000000) ifTrue: [self
> updateOffsetFromUTC]
>
> Right?
>

Excellent point.  So the drift algorithm to provide an accurate clock can
be extended to check the time zone whenever the new time is at a different
second to the previous value.


> - Bert -


_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20160325/9d217c26/attachment.htm


More information about the Squeak-dev mailing list