[Pharo-project] Synchronizing system time

Camillo Bruni camillobruni at gmail.com
Fri Jul 13 09:48:26 EDT 2012

On 2012-07-13, at 08:45, Denis Kudriashov wrote:

> Hello,
> I try to implement system time synchronization with some server.
> And I found that when system OS time changed running pharo instance don't
> see that.
> I execute DateAndTime>>initializeOffsets but it not helps.
> Is it bug somewhere?
> Is it possible to reinitialize OS date and time from running pharo?

Instances of DateAndTime directly store the seconds / nanoseconds for they time.
If the underlying system time changes this is not reflected in the existing instances...

If you can get somehow the offset by which the time changed you can manually loop
over all DateAndTime objects and replace the internal representations...

DateAndTime allInstances do: [ :each|
	each instVarNamed: #seconds put: each seconds + systemTimeChange ].

> I use WindowsXP
> Best regards,
> Denis

More information about the Pharo-dev mailing list