'From Squeak3.3alpha of 11 January 2002 [latest update: #4816] on 10 April 2002 at 12:15:48 am'! "Change Set: FixDST Date: 10 April 2002 Author: Dan Ingalls Published as 4825FixDST-di.cs in 3.3a. Fixes a bug in daylightSavingsInEffect, and adds a more precise method, daylightSavingsInEffectAtStandardHour: hour. The could be better factored, but at least they work, and I have now tested them pretty well. "! !Date methodsFor: 'inquiries' stamp: 'di 4/7/2002 23:08'! daylightSavingsInEffect "Return true if DST is observed at or after 2am on this day" self dayMonthYearDo: [:day :month :year | (month < 4 or: [month > 10]) ifTrue: [^ false]. "False November through March" (month > 4 and: [month < 10]) ifTrue: [^ true]. "True May through September" month = 4 ifTrue: ["It's April -- true on first Sunday or later" day >= 7 ifTrue: [^ true]. "Must be after" ^ day > (self weekdayIndex \\ 7)] ifFalse: ["It's October -- false on last Sunday or later". day <= 24 ifTrue: [^ true]. "Must be before" ^ day <= (24 + (self weekdayIndex \\ 7))]]! ! !Date methodsFor: 'inquiries' stamp: 'di 4/7/2002 09:12'! daylightSavingsInEffectAtStandardHour: hour "Return true if DST is observed at this very hour (standard time)" "Note: this *should* be the kernel method, and daylightSavingsInEffect should simply be self daylightSavingsInEffectAtHour: 3" self daylightSavingsInEffect ifTrue: [^ (self addDays: -1) daylightSavingsInEffect or: [hour >= 2]] ifFalse: [^ (self addDays: -1) daylightSavingsInEffect and: [hour < 1]]! ! !Time methodsFor: 'arithmetic' stamp: 'di 4/7/2002 13:29'! addSeconds: nSeconds "Answer a Time that is nSeconds after the receiver." ^Time fromSeconds: self asSeconds + nSeconds! !