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. I have not been able to find where in Pharo I can call to update the System clock to the correct time. Any help greatly appreciated. Jimmie |
> 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. > 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) > > Any help greatly appreciated. > > Jimmie > |
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 |
'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 > -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. |
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 >> |
On Sun, May 1, 2011 at 4:15 AM, Jimmie Houchin <[hidden email]> wrote: Hello, I have no idea about these topics...but maybe something related to the Delay issue that Gary and Andrian used to have: http://code.google.com/p/pharo/issues/detail?id=3986
-- Mariano http://marianopeck.wordpress.com |
In reply to this post by Jimmie Houchin-5
Strange. I cannot produce this problem on OSX.
Alexandre On 30 Apr 2011, at 22:15, Jimmie Houchin wrote: > 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 >>> > > -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. |
Does the Windows VM depend on QueryPerformanceCounter()?
On 5/1/11 16:53 , Alexandre Bergel wrote: > Strange. I cannot produce this problem on OSX. > > Alexandre > > > On 30 Apr 2011, at 22:15, Jimmie Houchin wrote: > >> 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 >>>> >> >> > |
In reply to this post by Jimmie Houchin-5
I downloaded the latest Pharo 1.3 and Cog vm to my Vista server.
I opened up a workspace and did the following at as precisely as my hand eye coordination allow at the top of the minute shown. The first time at the bottom shows exactly identical time with the OS clock. The second time above it, show a 5 second gain in time in a little over 24 hours. I am going to let this image keep going and see how it continues. DateAndTime now. 2011-05-01T23:45:05-05:00 lost 5 seconds since the below 2011-04-30T20:16:00-05:00 opened Pharo and checked time. For me, this is now verified on 2 Windows Vista computers. One a laptop, and the other a Desktop machine I use as a server. Both are reasonably current Dells. The laptop with a duo-core processor and the desktop a quad-core processor. I have not done any attempts on any other OS. Thanks. Jimmie On 4/30/2011 12:03 PM, Jimmie Houchin 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. > > I have not been able to find where in Pharo I can call to update the > System clock to the correct time. > > Any help greatly appreciated. > > Jimmie |
thanks for the report.
Stef On May 2, 2011, at 7:00 AM, Jimmie Houchin wrote: > I downloaded the latest Pharo 1.3 and Cog vm to my Vista server. > > I opened up a workspace and did the following at as precisely as my hand eye coordination allow at the top of the minute shown. > > The first time at the bottom shows exactly identical time with the OS clock. > The second time above it, show a 5 second gain in time in a little over 24 hours. > > I am going to let this image keep going and see how it continues. > > DateAndTime now. > 2011-05-01T23:45:05-05:00 lost 5 seconds since the below > 2011-04-30T20:16:00-05:00 opened Pharo and checked time. > > For me, this is now verified on 2 Windows Vista computers. One a laptop, and the other a Desktop machine I use as a server. Both are reasonably current Dells. The laptop with a duo-core processor and the desktop a quad-core processor. > > I have not done any attempts on any other OS. > > Thanks. > > Jimmie > > > > On 4/30/2011 12:03 PM, Jimmie Houchin 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. >> >> I have not been able to find where in Pharo I can call to update the System clock to the correct time. >> >> Any help greatly appreciated. >> >> Jimmie > > |
In reply to this post by Andres Valloud-4
On Mon, May 2, 2011 at 12:56 AM, Andres Valloud <[hidden email]> wrote: Does the Windows VM depend on QueryPerformanceCounter()? I have no idea what that is, but a quick grep -n "QueryPerformanceCounte" -r ~/Pharo/vm/git/cogVMMaster/blessed/platforms tell me that not.
-- Mariano http://marianopeck.wordpress.com |
I'd look into how the VM knows what time it is. Sooner or later there
will be a primitive or some FFI call that asks the OS to tell you the time. You should follow the VM Code Lawyer's Standard Procedure(TM): 1. What is the VM doing, exactly? 2. What are the relevant *official* specifications governing what the VM is doing? Be thorough in your search. 3. Does the VM implementation comply 100% with the specifications' requirements? If you cannot answer "yes" at step 3, then you don't know what's going on. Chances are the VM merely *appears* to work, but you can't quite explain why. This is bad and should be rectified. If you are forced to answer "no" at step 3, then you know the VM is Broken(TM). A lot of bugs are caused by specification violations. I know working with C specifications is not cool because it's not Smalltalk and all of that stuff, but I think it's even less cool to have a Broken(TM) VM so something has to be done. I did some investigation about similar problems for Windows not long ago. Basically, relying on the function QueryPerformanceCounter() is just bad. Moreover, if the x86 VMs depend on the CPU's timestamp counter, then you are going to get problems like those you get with QueryPerformanceCounter(). Trace through the documentation on the function QueryPerformanceCounter(), the boot switch /usepmtimer, and something called HPET. On 5/2/11 0:49 , Mariano Martinez Peck wrote: > > > On Mon, May 2, 2011 at 12:56 AM, Andres Valloud > <[hidden email] > <mailto:[hidden email]>> wrote: > > Does the Windows VM depend on QueryPerformanceCounter()? > > > I have no idea what that is, but a quick > > grep -n "QueryPerformanceCounte" -r > ~/Pharo/vm/git/cogVMMaster/blessed/platforms > > tell me that not. > > > > On 5/1/11 16:53 , Alexandre Bergel wrote: > > Strange. I cannot produce this problem on OSX. > > Alexandre > > > On 30 Apr 2011, at 22:15, Jimmie Houchin wrote: > > 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 <http://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 > > > > > > > > > -- > Mariano > http://marianopeck.wordpress.com > |
In reply to this post by Andres Valloud-4
On 02.05.2011 00:56, Andres Valloud wrote:
> Does the Windows VM depend on QueryPerformanceCounter()? The Cog VM (which it seemed Jimmie was using) uses a clock (sqWin32Heartbeat.c) initialized with GetSystemTimeAsFileTime and timeGetTime then adds an offset based on current timeGetTime (reinitialization happens at rollovers) I can't see any mention of drift in the Microsoft documentation of timeGetTime, but I guess there must be some? Cheers, Henry |
Ok, so each time you add the offset things become more and more imprecise...
http://msdn.microsoft.com/en-us/library/dd757629%28v=vs.85%29.aspx "The default precision of the timeGetTime function can be five milliseconds or more, depending on the machine. You can use the timeBeginPeriod and timeEndPeriod functions to increase the precision of timeGetTime. If you do so, the minimum difference between successive values returned by timeGetTime can be as large as the minimum period value set using timeBeginPeriod and timeEndPeriod." Note you cannot even assume what the precision is because the function timeBeginPeriod() changes the precision for EVERY program (plus it has other side effects). Of course, then the docs state "Use the QueryPerformanceCounter and QueryPerformanceFrequency functions to measure short time intervals at a high resolution" even though the relevant specs mention all sorts of problems when one uses QueryPerformanceCounter(). This is typical MSDN, unfortunately. On 5/2/11 3:56 , Henrik Sperre Johansen wrote: > On 02.05.2011 00:56, Andres Valloud wrote: >> Does the Windows VM depend on QueryPerformanceCounter()? > The Cog VM (which it seemed Jimmie was using) uses a clock > (sqWin32Heartbeat.c) initialized with > GetSystemTimeAsFileTime and timeGetTime > then adds an offset based on current timeGetTime (reinitialization > happens at rollovers) > > I can't see any mention of drift in the Microsoft documentation of > timeGetTime, but I guess there must be some? > > Cheers, > Henry > > |
On 02.05.2011 13:02, Andres Valloud wrote:
> Ok, so each time you add the offset things become more and more > imprecise... > > http://msdn.microsoft.com/en-us/library/dd757629%28v=vs.85%29.aspx > > "The default precision of the timeGetTime function can be five > milliseconds or more, depending on the machine. You can use the > timeBeginPeriod and timeEndPeriod functions to increase the precision > of timeGetTime. If you do so, the minimum difference between > successive values returned by timeGetTime can be as large as the > minimum period value set using timeBeginPeriod and timeEndPeriod." > > Note you cannot even assume what the precision is because the function > timeBeginPeriod() changes the precision for EVERY program (plus it has > other side effects). Of course, then the docs state > > "Use the QueryPerformanceCounter and QueryPerformanceFrequency > functions to measure short time intervals at a high resolution" > > even though the relevant specs mention all sorts of problems when one > uses QueryPerformanceCounter(). This is typical MSDN, unfortunately. within 5 milliseconds. The current time is calculated baseTime + (newTimeGetTime - baseTimeGetTime) , so precisions not adding up does not explain drifts of 36 seconds... Then when timeGetTime wraps, new baseTime + baseTimeGetTime is obtained. Cheers, Henry |
> The way I read it, each _call_ to timeGetTime should be accurate to
> within 5 milliseconds. The docs say 5ms or more, depending on the machine, and there is no indication of what affects the precision on the machine. But even if that's irrelevant, your argument assumes nobody else in the machine called timerBeginPeriod with an argument of, say, 100. Basically, relying on timeGetTime is bound to cause problems because it forces you to assume (guess) what every other program is doing, which opens the door to wrong assumptions and weird, hard to reproduce behavior. > The current time is calculated > baseTime + (newTimeGetTime - baseTimeGetTime) , so precisions not adding > up does not explain drifts of 36 seconds... How many times is timeGetTime() called during the accumulated drift? Andres. |
In reply to this post by Jimmie Houchin-5
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 <[hidden email]> > > Date: May 1, 2011 4:15:40 AM GMT+02:00 > > To: [hidden email] > > Subject: Re: [Pharo-project] System time > > Reply-To: [hidden email] > > > > 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 > >>> > > > > |
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 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 CheckTimeDrift.st (2K) Download Attachment |
David T. Lewis wrote:
I'm just starting in Smalltalk, so I'll make some very generic comments.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.stI 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 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 |
Free forum by Nabble | Edit this page |