<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 25, 2016 at 9:23 AM, Bert Freudenberg <span dir="ltr"><<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 25.03.2016, at 16:51, David T. Lewis <<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>> wrote:<br>
><br>
> On Thu, Mar 24, 2016 at 10:05:17PM -0700, Eliot Miranda wrote:<br>
</span><span class="">>> I see two or three system calls in the code below. gettimeofday, one inside localtime and one inside gmtime. That's expensive.<br>
>><br>
><br>
> It's gettimeofday() and localtime(). The #else is fallback for older unix platforms.<br>
><br>
> In any case, caching the value and updating it periodically does not sound like a good idea to me.<br>
<br>
</span>Well, it’s okay to cheat as long as you won’t get caught (says DI).<br>
<br>
Simply “once a second” is not good enough if we check the time 0.5 seconds after DST switch.<br>
<br>
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<br>
<br>
(prevUsecs // 1000000) ~= (nowUsecs // 1000000) ifTrue: [self updateOffsetFromUTC]<br>
<br>
Right?<br></blockquote><div><br></div><div>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.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">- Bert -</font></span></blockquote><div> </div></div><div class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>