[squeak-dev] Bug in primitiveUtcWithOffset on Windows

christoph.thiede at student.hpi.uni-potsdam.de christoph.thiede at student.hpi.uni-potsdam.de
Mon Aug 30 18:51:29 UTC 2021

Hi Levente,

thanks for your support! :-)

I just took a second look on this issue. As plugging out my laptop again and again felt pretty tedious, I changed my system clock via the Windows settings. Neither #primitiveUpdateTimeZone nor #utcMicrosecondClock helped to see this change in my image.

However, based on a hint by Marcel, I took a look into the VM and was able to find out under which circumstances the VM time is updated from the operating system. I added a small hook resyncSystemTime() that triggers a resync whenever the operating system sends the message WM_TIMECHANGE and now both primitives appear to work as expected! Please see (and ideally review) my PR here: https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/588

Here are just two further observations:

- In my Windows Subsystem for Linux/Ubuntu, time changes were already reflected correctly in the image.
- Applicable to both linux and windows: When I pull the clock backward (instead of forward), my image hangs, until ... guess what? It hangs until the system time greater equals the last known time in Squeak before I pulled the clock backward again! :D Because this issue occurs cross-platform, however, I think it is a separate issue and shouldn't block my PR.

Thank you Marcel and Levente for your help!


Sent from Squeak Inbox Talk

On 2021-06-29T19:04:11+02:00, leves at caesar.elte.hu wrote:

> Hi Christoph,
> On Tue, 29 Jun 2021, Thiede, Christoph wrote:
> > 
> > Hi all,
> > 
> > 
> > recently, the battery of my laptop has broken (will never buy an HP device again, rude support ...), so currently, I'm only using my device only with a direct power supply. When I unplug it while it is shut
> > down/in hibernation mode, the system time will be reset. Windows knows how to deal with it and only seconds after rebooting, it will fetch the current time from a time server again. However, Squeak/OSVM have problems with
> > this. In the last two weeks, I have noticed multiple cases where the image clock in the docking bar would not be updated after resuming from hibernation mode but continue to count from the previous evening's time. More
> > precisely, primitiveUtcWithOffset always returns a time that is behind by the duration for which my device was shut down at the night. After restarting the VM, the time is synced again.
> > 
> > 
> > I'm on Windows 20H1. Maybe some chronological expert here has an idea of how the VM could be tweaked in order to reflect the time changes applied by Windows time synchronization? :-)
> Try invoking primitive 243 - aka Time primitiveUpdateTimeZone and see if 
> that helps.
> Also check whether primitive 240 - aka Time utcMicrosecondClock is 
> affected by the delay.
> Levente
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210830/8076cf34/attachment.html>

More information about the Squeak-dev mailing list