The Trunk: Kernel-bf.994.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Kernel-bf.994.mcz

commits-2
Bert Freudenberg uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-bf.994.mcz

==================== Summary ====================

Name: Kernel-bf.994
Author: bf
Time: 18 February 2016, 2:59:01.974843 pm
UUID: e47a7687-8244-43f0-b608-3f0759ac382d
Ancestors: Kernel-eem.993

Make Timespan explicitly ignore its start's timezone offset if it was created with the defaultOffset.

=============== Diff against Kernel-eem.993 ===============

Item was removed:
- ----- Method: DateAndTime class>>nowWithOffset: (in category 'squeak protocol') -----
- nowWithOffset: aDuration
- ^ self
- now: self clock localMicrosecondClockWithOffset first
- offset: aDuration!

Item was added:
+ ----- Method: DateAndTime>>hasSmallerTicksThan: (in category 'private') -----
+ hasSmallerTicksThan: aDateAndTime
+
+ ^ jdn < aDateAndTime julianDayNumber or:
+ [ jdn > aDateAndTime julianDayNumber
+ ifTrue: [ false ]
+ ifFalse:
+ [ seconds < aDateAndTime secondsSinceMidnight or:
+ [ seconds > aDateAndTime secondsSinceMidnight
+ ifTrue: [ false ]
+ ifFalse: [ nanoSeconds < aDateAndTime nanoSecond ] ] ] ]!

Item was added:
+ ----- Method: DateAndTime>>ignoreTimezone (in category 'private') -----
+ ignoreTimezone
+ "For polymorphism with Timespan"
+ ^false!

Item was changed:
  Magnitude subclass: #Timespan
  instanceVariableNames: 'start duration'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'Kernel-Chronology'!
 
+ !Timespan commentStamp: 'bf 2/18/2016 14:43' prior: 0!
+ I represent a duration starting on a specific DateAndTime.
+
+ If my start has an offset identical to my #defaultOffset then comparisons ignore timezone offset.!
- !Timespan commentStamp: 'dtl 7/11/2009 16:35' prior: 0!
- I represent a duration starting on a specific DateAndTime.!

Item was changed:
  ----- Method: Timespan class>>current (in category 'squeak protocol') -----
  current
+ ^ self starting: (DateAndTime now offset: self defaultOffset)!
- ^ self starting: (DateAndTime nowWithOffset: self defaultOffset)!

Item was changed:
  ----- Method: Timespan>>< (in category 'ansi protocol') -----
  < comparand
+ ^(self ignoreTimezone or: [comparand ignoreTimezone])
+ ifTrue: [self start hasSmallerTicksThan: comparand asDateAndTime]
+ ifFalse: [self start < comparand asDateAndTime]
+ !
-
- ^ self start < comparand!

Item was changed:
  ----- Method: Timespan>>= (in category 'ansi protocol') -----
  = comparand
  ^ self class = comparand class
+ and: [((self ignoreTimezone or: [ comparand ignoreTimezone ])
+ ifTrue: [ self start hasEqualTicks: comparand start ]
+ ifFalse: [ self start = comparand start ])
- and: [ "defaultOffset means ignore time zone"
- ((self start offset == self class defaultOffset
- or: [comparand start offset ==  self class defaultOffset])
- ifTrue: [self start hasEqualTicks: comparand start]
- ifFalse: [self start = comparand start])
  and: [ self duration = comparand duration ] ]
  .!

Item was added:
+ ----- Method: Timespan>>ignoreTimezone (in category 'private') -----
+ ignoreTimezone
+ ^ start offset == self class defaultOffset!