<br><br><div class="gmail_quote">On Tue, May 3, 2011 at 5:44 PM, David T. Lewis <span dir="ltr">&lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
 <br>On Tue, May 03, 2011 at 04:02:04AM +0200, Levente Uzonyi wrote:<br>
&gt;<br>
&gt; On Mon, 2 May 2011, David T. Lewis wrote:<br>
&gt; &gt;<br>
&gt; &gt;I have not looked at this carefully, but I suspect an issue in Chronology<br>
&gt; &gt;(as opposed to a VM or primitive issue). DateAndTime initializes some<br>
&gt; &gt;cached<br>
&gt; &gt;values at image startup time, and thereafter calculates things based on the<br>
&gt; &gt;millisecond clock. If the millisecond clock drifts with respect to system<br>
&gt; &gt;time<br>
&gt; &gt;on the underlying platform (as presumably would be the case if the system<br>
&gt; &gt;clock<br>
&gt; &gt;is synchronized using ntp), then DateAndTime&#39;s opinion about current time<br>
&gt; &gt;will<br>
&gt; &gt;drift with respect to the underlying platform.<br>
&gt;<br>
&gt; The amount of the drift seems to be 1 millisecond every 14-16 seconds on<br>
&gt; my pc. I wrote some code to get the system time via FFI[1], then ran the<br>
&gt; following:<br>
&gt;<br>
&gt; | data |<br>
&gt; data := (1 to: 100) collect: [ :run |<br>
&gt;       1 seconds asDelay wait.<br>
&gt;       { DateAndTime now. Win32SystemTime localDateAndTime } ].<br>
&gt; (data collect: [ :each | each first - each second ] as: Set) sorted explore<br>
&gt;<br>
&gt;<br>
&gt; Levente<br>
&gt;<br>
&gt; [1] <a href="http://leves.web.elte.hu/squeak/Win32SystemTime.st" target="_blank">http://leves.web.elte.hu/squeak/Win32SystemTime.st</a><br>
<br>
I am now running a similar test (attached) on Linux. I was expecting<br>
to see clock drift exactly the same as that reported on Windows, but<br>
so far after about 15 minutes I see no obvious signs of drift. I<br>
cannot explain this but I&#39;ll leave it running for a while and see<br>
if anything interesting happens.<br></blockquote><div><br></div><div>Its because on linux &amp; mac the clock is derived from gettimeofday which is wall time but on Windows it is derived from timeGetTime which isn&#39;t.  The problem is the lack of a high-resolution wall time on Windows.  GetSystemTimeAsFileTime et al have something like 16 ms resolution whereas timeGetTime has 1ms resolution.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Dave<br>
<br>
sample output:<br>
<br>
=== Started at 2011-05-03T20:24:35.03-04:00 ===<br>
Test duration 0:00:15:46.01<br>
OS time now: 2011-05-03T20:40:<a href="tel:21.039466-04" value="+12103946604">21.039466-04</a>:00<br>
Squeak time now: 2011-05-03T20:40:21.04-04:00<br>
Difference: 0:00:00:00.000534<br>
Drift: 0:00:00:00.000075<br>
=== Started at 2011-05-03T20:24:35.03-04:00 ===<br>
Test duration 0:00:15:49.072<br>
OS time now: 2011-05-03T20:40:24.101675-04:00<br>
Squeak time now: 2011-05-03T20:40:24.102-04:00<br>
Difference: 0:00:00:00.000325<br>
Drift: -0:00:00:00.000134<br>
=== Started at 2011-05-03T20:24:35.03-04:00 ===<br>
Test duration 0:00:15:52.102<br>
OS time now: 2011-05-03T20:40:27.131382-04:00<br>
Squeak time now: 2011-05-03T20:40:27.132-04:00<br>
Difference: 0:00:00:00.000618<br>
Drift: 0:00:00:00.000159<br>
=== Started at 2011-05-03T20:24:35.03-04:00 ===<br>
Test duration 0:00:15:55.136<br>
OS time now: 2011-05-03T20:40:<a href="tel:30.165711-04" value="+13016571104">30.165711-04</a>:00<br>
Squeak time now: 2011-05-03T20:40:30.166-04:00<br>
Difference: 0:00:00:00.000289<br>
Drift: -0:00:00:00.00017<br>
<br>
<br></blockquote></div><br>