[Vm-dev] Fwd: [Pharo-project] System time

David T. Lewis lewis at mail.msen.com
Mon May 2 22:29:15 UTC 2011


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.

Dave

On Sun, May 01, 2011 at 08:24:49AM +0200, stephane ducasse wrote:
> 
> Begin forwarded message:
> 
> > From: Jimmie Houchin <jlhouchin at gmail.com>
> > Date: May 1, 2011 4:15:40 AM GMT+02:00
> > To: Pharo-project at lists.gforge.inria.fr
> > Subject: Re: [Pharo-project] System time
> > Reply-To: Pharo-project at lists.gforge.inria.fr
> > 
> > Hello,
> > 
> > My OS for this application is Windows. On a freshly opened image, the image and OS time are in sync. Over a period of time the image drifted 34 seconds away from OS time. I do not know how long I had this image open, but it has been a number of days, possibly a week plus.
> > 
> > I saved the image and quit. I reopened the image and did DateAndTime now and it was in sync with the OS once again. Same image, vm and OS that was out of sync by 34 seconds only one minute before.
> > 
> > I have opened an image on my server which is also running the latest cog vm, the current Pharo 1.3 and Windows Vista. I am going to periodically do a DateAndTime now to log the drift if any. Prior to opening this image I updated the OS system clock with time.nist.gov which is about 1000 miles away.
> > 
> > I know that within a second or so it can be subject to my coordination of doing DateAndTime now while watching my OS system clocks seconds. But 34 seconds is beyond any subjective standards.
> > 
> > The only reason I discovered this was while exploring how I want to retrieve my data, act upon my data and then pause (Delay wait) until time to repeat.
> >    dtnow := DateAndTime now.
> >    dtnext := DateAndTime year: 2011 month: 4 day: 30 hour: 11 minute: i second: 5.   "The next minute in the future"
> >    (Delay forDuration: (dtnext - dtnow)) wait.
> > 
> > I got an error, that Duration cannot be a negative number. As I processed the debugger, I saw that dtnow was greater than dtnext. I watched the OS clock and manually selected the next minute before I executed. However, I was within that 34 second window.
> > 
> > So now I am exploring the problem.
> > 
> > Thanks.
> > 
> > Jimmie
> > 
> > On 4/30/2011 5:06 PM, Alexandre Bergel wrote:
> >> 'Time now' gives me the same result than OSX
> >> 
> >> Alexandre
> >> 
> >> 
> >> On 30 Apr 2011, at 16:15, Jimmie Houchin wrote:
> >> 
> >>> On 4/30/2011 11:50 AM, St?phane Ducasse wrote:
> >>>>> I am developing a time sensitive application. I poll a server every minute for new data. The data is time sensitive and the sooner I can get the data to the release of the data the better.
> >>>>> 
> >>>>> I have noticed that Pharo's system time drifts away from the OS system time. I would really like the Pharo system time to be the correct time.
> >>>> do you have a repeatable scenario?
> >>>> VM
> >>>> Image information.
> >>> Pharo 1.3 and the latest Cog.
> >>> 
> >>>>> I have not been able to find where in Pharo I can call to update the System clock to the correct time.
> >>>> you can use OSProcess (only mac and linux)
> >>> No, that's not the problem. The OS clock is right. It's Pharo that has drifted away from correct time. Regardless it would be nice if I have to correct the OS clock, it would still be nice to resync Pharo with the OS, keep both in sync and correct. What I am wanting is simply to resync the Pharo clock with the OS clock.
> >>> 
> >>> It seems that when the Pharo image is started that it gets the OS System time, but keeps its own time after that. Now I do not know the consequences of Pharo adjusting its time backward. If this isn't possible, then I might have to do some workarounds to insure that I get my data in a timely manner.
> >>> 
> >>> The image I have been developing in is currently about 30 seconds ahead of the OS clock. It is on my laptop. It might be due to the laptops sleep and hibernation. I have not tested this on my server.
> >>> 
> >>> That is the situation as best I know it.
> >>> 
> >>> Thanks.
> >>> 
> >>> Jimmie
> >>> 
> > 
> > 


More information about the Vm-dev mailing list