David T. Lewis wrote:
On Tue, May 03, 2011 at 04:02:04AM +0200, Levente Uzonyi wrote:
  
On Mon, 2 May 2011, David T. Lewis wrote:
    
I have not looked at this carefully, but I suspect an issue in Chronology
(as opposed to a VM or primitive issue). DateAndTime initializes some 
cached
values at image startup time, and thereafter calculates things based on the
millisecond clock. If the millisecond clock drifts with respect to system 
time
on the underlying platform (as presumably would be the case if the system 
clock
is synchronized using ntp), then DateAndTime's opinion about current time 
will
drift with respect to the underlying platform.
      
The amount of the drift seems to be 1 millisecond every 14-16 seconds on 
my pc. I wrote some code to get the system time via FFI[1], then ran the 
following:

| data |
data := (1 to: 100) collect: [ :run |
	1 seconds asDelay wait.
	{ DateAndTime now. Win32SystemTime localDateAndTime } ].
(data collect: [ :each | each first - each second ] as: Set) sorted explore


Levente

[1] http://leves.web.elte.hu/squeak/Win32SystemTime.st
    
I am now running a similar test (attached) on Linux. I was expecting
to see clock drift exactly the same as that reported on Windows, but
so far after about 15 minutes I see no obvious signs of drift. I
cannot explain this but I'll leave it running for a while and see
if anything interesting happens.

Dave

sample output:

=== Started at 2011-05-03T20:24:35.03-04:00 ===
Test duration 0:00:15:46.01
OS time now: 2011-05-03T20:40:21.039466-04:00
Squeak time now: 2011-05-03T20:40:21.04-04:00
Difference: 0:00:00:00.000534
Drift: 0:00:00:00.000075
=== Started at 2011-05-03T20:24:35.03-04:00 ===
Test duration 0:00:15:49.072
OS time now: 2011-05-03T20:40:24.101675-04:00
Squeak time now: 2011-05-03T20:40:24.102-04:00
Difference: 0:00:00:00.000325
Drift: -0:00:00:00.000134
=== Started at 2011-05-03T20:24:35.03-04:00 ===
Test duration 0:00:15:52.102
OS time now: 2011-05-03T20:40:27.131382-04:00
Squeak time now: 2011-05-03T20:40:27.132-04:00
Difference: 0:00:00:00.000618
Drift: 0:00:00:00.000159
=== Started at 2011-05-03T20:24:35.03-04:00 ===
Test duration 0:00:15:55.136
OS time now: 2011-05-03T20:40:30.165711-04:00
Squeak time now: 2011-05-03T20:40:30.166-04:00
Difference: 0:00:00:00.000289
Drift: -0:00:00:00.00017
  
I'm just starting in Smalltalk, so I'll make some very generic comments.
1. Could the squeak exe process get a system interrupt between when it reads the time from windows and when it it adds a ticks to its clock.
2. VMWare is a completely different form of virtual machine from Squeak, however interesting reading none the less.  More than you wanted to know about system time: http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf
3.  Idea from (2.) possibly test the effect of running QuickTime in parallel with Squeak?

Ben

Reply via email to