[squeak-dev] Should a long running image notice daylight saving?

Levente Uzonyi leves at caesar.elte.hu
Sun Apr 2 12:08:07 UTC 2017


Hi Herbert,

This issue was discussed[1] here recently. I suggested[2] a VM change to 
solve this problem, but the same thing can be done on the image side too.
Just change Time class >> #utcMicrosecondClockWithOffset to be:

utcMicrosecondClockWithOffset
 	"Answer an array with UTC microseconds since the Smalltalk epoch and the
 	current seconds offset from UTC in the local time zone."

 	| utc currentMinute |
 	utc := self utcMicrosecondClock.
 	currentMinute := utc // 60000000.
 	LastTimeTimeZoneWasUpdated = currentMinute ifFalse: [
 		LastTimeTimeZoneWasUpdated := currentMinute.
 		TimeZoneOffset := Locale current primTimezone * 60 ].
 	^{ utc. TimeZoneOffset }

and Time class >> #localMicrosecondClock to be:

localMicrosecondClock
 	"Answer the local microseconds since the Smalltalk epoch (January 1st 1901, the start of the 20th century).
 	 The value is derived from the current UTC wallclock time and the image's current notion of time zone."

 	| utcMicrosecondClockWithOffset |
 	utcMicrosecondClockWithOffset := self utcMicrosecondClockWithOffset.
 	^(utcMicrosecondClockWithOffset at: 2) * 1000000 + (utcMicrosecondClockWithOffset at: 1)


LastTimeTimeZoneWasUpdated and TimeZoneOffset should be class variables. 
They don't have to be initialized.

Levente

[1] http://lists.squeakfoundation.org/pipermail/squeak-dev/2017-March/193594.html
[2] http://lists.squeakfoundation.org/pipermail/squeak-dev/2017-March/193638.html

On Sun, 2 Apr 2017, Herbert König wrote:

> Hi all,
>
> I have a long running 5.1 image on a Raspi A+ which regularly waits on a 
> Delay.
>
> Raspbian has noticed daylight saving, Squeak not.
>
> Is this expected and what can I do with the running image to make it 
> notice? Except waiting for the monthly crash and restart :-)
>
>
> Cheers,
>
> Herbert
>
>
>


More information about the Squeak-dev mailing list