Bug 36390

GemBuilder for Smalltalk

7.1.2, 7.1.1, 7.1, 7.0.2, 7.0.1, 7.0, 6.2, 6.1, 6.0, 5.2.5, 5.2.4, 5.2.3, 5.2.2

All

7.2, 5.3, 5.2.6

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.

Workaround:

File the following into the VA or VW image:

!GbsTimeZone publicMethods !

localDateTimeFromGMT: gmtDateTime

"Convert the GMT DateTime to a local DateTime, returned as a new
instance.
  The argument is not modified."

"first convert the DateTime to local time, then decide when if the time
is in
Daylight Savings Time. If so, adjust."

| localDateTime |

localDateTime := self datetimeClass fromMilliseconds: gmtDateTime
gbxAsMilliseconds + (secondsFromGMT * 1000).
^(self isDST: localDateTime)
  ifTrue: [ localDateTime addSeconds: secondsForDST ]
  ifFalse:[ localDateTime ]
! !


Last updated: 2/22/07