DST change applied at GMT, not local time
GemStone Server DateTime instances are stored as GMT (UTC) values,
and when they are replicated to the client, they are adjusted to
local time based on the local TimeZone settings on the client
Smalltalk. The calculation for this incorrectly started and ended
Daylight Savings Time (DST) at the time of the change (usually 2am)
in GMT time, not local time.
DateTimes in the range from 2am GMT to 2am local time would be incorrect by one hour.
For example, at 2am GMT it is 6pm the day before in Portland, Oregon.
DST should begin in Portland on Sunday, March 11 at 2am, however,
DateTimes would be adjusted for DST starting at 6pm on Saturday,
March 10. All DateTimes replicated between 6pm on March 10 and
2am on March 11 would be incorrect by one hour.
File the following into the VA or VW image:
!GbsTimeZone publicMethods !
"Convert the GMT DateTime to a local DateTime, returned as a new
The argument is not modified."
"first convert the DateTime to local time, then decide when if the time
Daylight Savings Time. If so, adjust."
| localDateTime |
localDateTime := self datetimeClass fromMilliseconds: gmtDateTime
gbxAsMilliseconds + (secondsFromGMT * 1000).
^(self isDST: localDateTime)
ifTrue: [ localDateTime addSeconds: secondsForDST ]
ifFalse:[ localDateTime ]