The Trunk: Chronology-Core-dtl.17.mcz

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

The Trunk: Chronology-Core-dtl.17.mcz

commits-2
David T. Lewis uploaded a new version of Chronology-Core to project The Trunk:
http://source.squeak.org/trunk/Chronology-Core-dtl.17.mcz

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

Name: Chronology-Core-dtl.17
Author: dtl
Time: 15 December 2018, 6:44:08.809994 pm
UUID: 9d9b49d4-46f4-496f-bfd1-70fdb1641e43
Ancestors: Chronology-Core-dtl.16

Bootstrap UTCDateAndTime, step 2 of 5

Start using LXDateAndTime instead of DateAndTime.
Change instance creation in DateAndTime to create LXDateAndTime instances instead.
In the postscript, have all DateAndTime instances become LXDateAndTime.

=============== Diff against Chronology-Core-dtl.16 ===============

Item was changed:
  ----- Method: DateAndTime class>>fromSeconds: (in category 'smalltalk-80') -----
  fromSeconds: seconds
  "Answer a DateAndTime since the Squeak epoch: 1 January 1901"
 
+ ^ LXDateAndTime fromSeconds: seconds
+ " | integerSeconds nanos |
- | integerSeconds nanos |
  integerSeconds := seconds truncated.
  integerSeconds = seconds
  ifTrue: [nanos := 0]
  ifFalse: [nanos := (seconds - integerSeconds * NanosInSecond) asInteger].
  ^ self basicNew
  ticks: (Array
  with: SqueakEpoch
  with: integerSeconds
  with: nanos)
+ offset: self localOffset"!
- offset: self localOffset!

Item was changed:
  ----- Method: DateAndTime class>>julianDayNumber:offset: (in category 'squeak protocol') -----
+ julianDayNumber: anInteger offset: aDuration
+ ^ LXDateAndTime julianDayNumber: anInteger offset: aDuration
+ " ^ self basicNew
+ ticks: anInteger days ticks
+ offset: aDuration ;
+ yourself"!
- julianDayNumber: anInteger offset: aDuration
-
- ^self basicNew
- setJdn: anInteger
- seconds: 0
- nano: 0
- offset: aDuration!

Item was changed:
  ----- Method: DateAndTime class>>now (in category 'ansi protocol') -----
  now
+
+ ^LXDateAndTime now.
+ " [ | timeArray |
+ timeArray := self primPosixMicrosecondClockWithOffset.
+ ^ self utcMicroseconds: timeArray first offset: timeArray second]
+ on: Error
+ do: [ ""Use old style primitive support""
+ ^self nowWithOffset: self localOffset]"!
- | clockAndOffset |
- clockAndOffset := self clock localMicrosecondClockWithOffset.
- (self automaticTimezone and:
- [self localOffset asSeconds ~= clockAndOffset second])
- ifTrue: [self localOffset: (Duration seconds: clockAndOffset second)].
- ^self now: clockAndOffset first offset: self localOffset!

Item was changed:
  ----- Method: DateAndTime class>>year:month:day:hour:minute:second:nanoSecond:offset: (in category 'squeak protocol') -----
  year: year month: month day: day hour: hour minute: minute second: second nanoSecond: nanoCount offset: offset
  "Return a DateAndTime"
 
+ ^ LXDateAndTime year: year month: month day: day hour: hour minute: minute second: second nanoSecond: nanoCount offset: offset
+ " | monthIndex daysInMonth p q r s julianDayNumber |
- | monthIndex daysInMonth p q r s julianDayNumber |
 
  monthIndex := month isInteger ifTrue: [month] ifFalse: [Month indexOfMonth: month].
  daysInMonth := Month
  daysInMonth: monthIndex
  forYear: year.
  day < 1 ifTrue: [self error: 'day may not be zero or negative'].
  day > daysInMonth ifTrue: [self error: 'day is after month ends'].
 
  p := (monthIndex - 14) quo: 12.
  q := year + 4800 + p.
  r := monthIndex - 2 - (12 * p).
  s := (year + 4900 + p) quo: 100.
 
  julianDayNumber :=
    ( (1461 * q) quo: 4 ) +
  ( (367 * r) quo: 12 ) -
    ( (3 * s) quo: 4 ) +
    ( day - 32075 ).
 
  ^self basicNew
  setJdn: julianDayNumber
  seconds: hour * 60 + minute * 60 + second
  nano: nanoCount
  offset: offset;
+ yourself"!
- yourself!

Item was added:
+ ----- Method: LXDateAndTime>>floor (in category 'squeak protocol') -----
+ floor
+ "Answer a copy with magnitude rounded down to the nearest whole second"
+ ^self class
+ utcMicroseconds: utcMicroseconds - (utcMicroseconds \\ 1000000)
+ offset: localOffsetSeconds!

Item was changed:
  ----- Method: TimeStamp class>>current (in category 'squeak protocol') -----
  current
 
+ ^self now!
- | ts ticks |
- ts := super now asTimeStamp.
- ticks := ts ticks.
- ticks at: 3 put: 0.
- ts ticks: ticks offset: ts offset.
- ^ ts
- !

Item was removed:
- ----- Method: TimeStamp class>>now (in category 'ansi protocol') -----
- now
- "Answer the current date and time as a TimeStamp."
-
- ^self current!

Item was changed:
  ----- Method: Timespan class>>defaultOffset (in category 'configuring') -----
  defaultOffset
+ "Timespans created in the context of an offset will start in that offset.  When no context is available, the defaultOffset for Timespans must be zero.  For example, two ways to make a Date for today:
+ Date today.  'start is midnight at offset zero.  Will compare successfully to other Date today results.'
+ DateAndTime now asDate.  'In this case, the start is midnight of the local time-zone.  It can only compare equally to Dates of its time-zone.'"
+ ^ Duration zero!
- "Timespans created in the context of an offset will start in that offset.  When no context is available, the defaultOffset for Timespans must be nil.  For example, two ways to make a Date for today:
- Date today.  'start is midnight without offset.  Will compare successfully to other Date today results.'
- DateAndTime now asDate.  'In this case, the start is midnight of the local time-zone.  It can only compare equally to Dates of its time-zone or Dates without timezone.'"
- ^ nil!

Item was changed:
+ (PackageInfo named: 'Chronology-Core') postscript: '"Convert all instances of DateAndTime and TimeStamp to the equivalent LXDateAndTime and LXTimeStamp."
- (PackageInfo named: 'Chronology-Core') postscript: '"Ensure that the object history mark process uses DateAndTime>>floor rather than an earlier implementation that relied on a named instance variable."
 
+ | oldInstances newInstances |
+ Smalltalk garbageCollect.
+ oldInstances := DateAndTime allInstances, TimeStamp allInstances.
+ newInstances := oldInstances collect: [ :each |
+         each class == DateAndTime
+                 ifTrue: [ each asLXDateAndTime ]
+                 ifFalse: [ each asLXTimeStamp ] ].
+ oldInstances elementsForwardIdentityTo: newInstances.
+ Smalltalk garbageCollect.
+
+ "Ensure that the object history mark process uses DateAndTime>>floor rather than an earlier implementation that relied on a named instance variable."
+
  Smalltalk at: #ObjectHistory ifPresent: [ :cls | cls current restartMarkProcess ].
  '!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Chronology-Core-dtl.17.mcz

David T. Lewis
I am running into a problem with an inconsistency between MCMcmUpdater loading
this version of Chronology, apparently because the updater calls a method that
do not exist in this (now 3 years old) set of Chronology derived classes.

For now I will deleto Chronology-Core-dtl.17 and Chronology-Core-dtl.16 from
trunk, hopefully before anyone does an update.

I will re-stage this and try another time.

Dave


On Sat, Dec 29, 2018 at 10:20:02PM +0000, [hidden email] wrote:

> David T. Lewis uploaded a new version of Chronology-Core to project The Trunk:
> http://source.squeak.org/trunk/Chronology-Core-dtl.17.mcz
>
> ==================== Summary ====================
>
> Name: Chronology-Core-dtl.17
> Author: dtl
> Time: 15 December 2018, 6:44:08.809994 pm
> UUID: 9d9b49d4-46f4-496f-bfd1-70fdb1641e43
> Ancestors: Chronology-Core-dtl.16
>
> Bootstrap UTCDateAndTime, step 2 of 5
>
> Start using LXDateAndTime instead of DateAndTime.
> Change instance creation in DateAndTime to create LXDateAndTime instances instead.
> In the postscript, have all DateAndTime instances become LXDateAndTime.
>
> =============== Diff against Chronology-Core-dtl.16 ===============
>
> Item was changed:
>   ----- Method: DateAndTime class>>fromSeconds: (in category 'smalltalk-80') -----
>   fromSeconds: seconds
>   "Answer a DateAndTime since the Squeak epoch: 1 January 1901"
>  
> + ^ LXDateAndTime fromSeconds: seconds
> + " | integerSeconds nanos |
> - | integerSeconds nanos |
>   integerSeconds := seconds truncated.
>   integerSeconds = seconds
>   ifTrue: [nanos := 0]
>   ifFalse: [nanos := (seconds - integerSeconds * NanosInSecond) asInteger].
>   ^ self basicNew
>   ticks: (Array
>   with: SqueakEpoch
>   with: integerSeconds
>   with: nanos)
> + offset: self localOffset"!
> - offset: self localOffset!
>
> Item was changed:
>   ----- Method: DateAndTime class>>julianDayNumber:offset: (in category 'squeak protocol') -----
> + julianDayNumber: anInteger offset: aDuration
> + ^ LXDateAndTime julianDayNumber: anInteger offset: aDuration
> + " ^ self basicNew
> + ticks: anInteger days ticks
> + offset: aDuration ;
> + yourself"!
> - julianDayNumber: anInteger offset: aDuration
> -
> - ^self basicNew
> - setJdn: anInteger
> - seconds: 0
> - nano: 0
> - offset: aDuration!
>
> Item was changed:
>   ----- Method: DateAndTime class>>now (in category 'ansi protocol') -----
>   now
> +
> + ^LXDateAndTime now.
> + " [ | timeArray |
> + timeArray := self primPosixMicrosecondClockWithOffset.
> + ^ self utcMicroseconds: timeArray first offset: timeArray second]
> + on: Error
> + do: [ ""Use old style primitive support""
> + ^self nowWithOffset: self localOffset]"!
> - | clockAndOffset |
> - clockAndOffset := self clock localMicrosecondClockWithOffset.
> - (self automaticTimezone and:
> - [self localOffset asSeconds ~= clockAndOffset second])
> - ifTrue: [self localOffset: (Duration seconds: clockAndOffset second)].
> - ^self now: clockAndOffset first offset: self localOffset!
>
> Item was changed:
>   ----- Method: DateAndTime class>>year:month:day:hour:minute:second:nanoSecond:offset: (in category 'squeak protocol') -----
>   year: year month: month day: day hour: hour minute: minute second: second nanoSecond: nanoCount offset: offset
>   "Return a DateAndTime"
>  
> + ^ LXDateAndTime year: year month: month day: day hour: hour minute: minute second: second nanoSecond: nanoCount offset: offset
> + " | monthIndex daysInMonth p q r s julianDayNumber |
> - | monthIndex daysInMonth p q r s julianDayNumber |
>  
>   monthIndex := month isInteger ifTrue: [month] ifFalse: [Month indexOfMonth: month].
>   daysInMonth := Month
>   daysInMonth: monthIndex
>   forYear: year.
>   day < 1 ifTrue: [self error: 'day may not be zero or negative'].
>   day > daysInMonth ifTrue: [self error: 'day is after month ends'].
>  
>   p := (monthIndex - 14) quo: 12.
>   q := year + 4800 + p.
>   r := monthIndex - 2 - (12 * p).
>   s := (year + 4900 + p) quo: 100.
>  
>   julianDayNumber :=
>     ( (1461 * q) quo: 4 ) +
>   ( (367 * r) quo: 12 ) -
>     ( (3 * s) quo: 4 ) +
>     ( day - 32075 ).
>  
>   ^self basicNew
>   setJdn: julianDayNumber
>   seconds: hour * 60 + minute * 60 + second
>   nano: nanoCount
>   offset: offset;
> + yourself"!
> - yourself!
>
> Item was added:
> + ----- Method: LXDateAndTime>>floor (in category 'squeak protocol') -----
> + floor
> + "Answer a copy with magnitude rounded down to the nearest whole second"
> + ^self class
> + utcMicroseconds: utcMicroseconds - (utcMicroseconds \\ 1000000)
> + offset: localOffsetSeconds!
>
> Item was changed:
>   ----- Method: TimeStamp class>>current (in category 'squeak protocol') -----
>   current
>  
> + ^self now!
> - | ts ticks |
> - ts := super now asTimeStamp.
> - ticks := ts ticks.
> - ticks at: 3 put: 0.
> - ts ticks: ticks offset: ts offset.
> - ^ ts
> - !
>
> Item was removed:
> - ----- Method: TimeStamp class>>now (in category 'ansi protocol') -----
> - now
> - "Answer the current date and time as a TimeStamp."
> -
> - ^self current!
>
> Item was changed:
>   ----- Method: Timespan class>>defaultOffset (in category 'configuring') -----
>   defaultOffset
> + "Timespans created in the context of an offset will start in that offset.  When no context is available, the defaultOffset for Timespans must be zero.  For example, two ways to make a Date for today:
> + Date today.  'start is midnight at offset zero.  Will compare successfully to other Date today results.'
> + DateAndTime now asDate.  'In this case, the start is midnight of the local time-zone.  It can only compare equally to Dates of its time-zone.'"
> + ^ Duration zero!
> - "Timespans created in the context of an offset will start in that offset.  When no context is available, the defaultOffset for Timespans must be nil.  For example, two ways to make a Date for today:
> - Date today.  'start is midnight without offset.  Will compare successfully to other Date today results.'
> - DateAndTime now asDate.  'In this case, the start is midnight of the local time-zone.  It can only compare equally to Dates of its time-zone or Dates without timezone.'"
> - ^ nil!
>
> Item was changed:
> + (PackageInfo named: 'Chronology-Core') postscript: '"Convert all instances of DateAndTime and TimeStamp to the equivalent LXDateAndTime and LXTimeStamp."
> - (PackageInfo named: 'Chronology-Core') postscript: '"Ensure that the object history mark process uses DateAndTime>>floor rather than an earlier implementation that relied on a named instance variable."
>  
> + | oldInstances newInstances |
> + Smalltalk garbageCollect.
> + oldInstances := DateAndTime allInstances, TimeStamp allInstances.
> + newInstances := oldInstances collect: [ :each |
> +         each class == DateAndTime
> +                 ifTrue: [ each asLXDateAndTime ]
> +                 ifFalse: [ each asLXTimeStamp ] ].
> + oldInstances elementsForwardIdentityTo: newInstances.
> + Smalltalk garbageCollect.
> +
> + "Ensure that the object history mark process uses DateAndTime>>floor rather than an earlier implementation that relied on a named instance variable."
> +
>   Smalltalk at: #ObjectHistory ifPresent: [ :cls | cls current restartMarkProcess ].
>   '!
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Chronology-Core-dtl.17.mcz

David T. Lewis
The two packages are moved back to inbox, so there are additional commit notices
for that. Inbox and trunk now are restored to their prior state.

Sorry for the noise.

Dave

On Sat, Dec 29, 2018 at 05:34:51PM -0500, David T. Lewis wrote:

> I am running into a problem with an inconsistency between MCMcmUpdater loading
> this version of Chronology, apparently because the updater calls a method that
> do not exist in this (now 3 years old) set of Chronology derived classes.
>
> For now I will deleto Chronology-Core-dtl.17 and Chronology-Core-dtl.16 from
> trunk, hopefully before anyone does an update.
>
> I will re-stage this and try another time.
>
> Dave
>
>
> On Sat, Dec 29, 2018 at 10:20:02PM +0000, [hidden email] wrote:
> > David T. Lewis uploaded a new version of Chronology-Core to project The Trunk:
> > http://source.squeak.org/trunk/Chronology-Core-dtl.17.mcz
> >
> > ==================== Summary ====================
> >
> > Name: Chronology-Core-dtl.17
> > Author: dtl
> > Time: 15 December 2018, 6:44:08.809994 pm
> > UUID: 9d9b49d4-46f4-496f-bfd1-70fdb1641e43
> > Ancestors: Chronology-Core-dtl.16
> >
> > Bootstrap UTCDateAndTime, step 2 of 5
> >
> > Start using LXDateAndTime instead of DateAndTime.
> > Change instance creation in DateAndTime to create LXDateAndTime instances instead.
> > In the postscript, have all DateAndTime instances become LXDateAndTime.
> >
> > =============== Diff against Chronology-Core-dtl.16 ===============
> >
> > Item was changed:
> >   ----- Method: DateAndTime class>>fromSeconds: (in category 'smalltalk-80') -----
> >   fromSeconds: seconds
> >   "Answer a DateAndTime since the Squeak epoch: 1 January 1901"
> >  
> > + ^ LXDateAndTime fromSeconds: seconds
> > + " | integerSeconds nanos |
> > - | integerSeconds nanos |
> >   integerSeconds := seconds truncated.
> >   integerSeconds = seconds
> >   ifTrue: [nanos := 0]
> >   ifFalse: [nanos := (seconds - integerSeconds * NanosInSecond) asInteger].
> >   ^ self basicNew
> >   ticks: (Array
> >   with: SqueakEpoch
> >   with: integerSeconds
> >   with: nanos)
> > + offset: self localOffset"!
> > - offset: self localOffset!
> >
> > Item was changed:
> >   ----- Method: DateAndTime class>>julianDayNumber:offset: (in category 'squeak protocol') -----
> > + julianDayNumber: anInteger offset: aDuration
> > + ^ LXDateAndTime julianDayNumber: anInteger offset: aDuration
> > + " ^ self basicNew
> > + ticks: anInteger days ticks
> > + offset: aDuration ;
> > + yourself"!
> > - julianDayNumber: anInteger offset: aDuration
> > -
> > - ^self basicNew
> > - setJdn: anInteger
> > - seconds: 0
> > - nano: 0
> > - offset: aDuration!
> >
> > Item was changed:
> >   ----- Method: DateAndTime class>>now (in category 'ansi protocol') -----
> >   now
> > +
> > + ^LXDateAndTime now.
> > + " [ | timeArray |
> > + timeArray := self primPosixMicrosecondClockWithOffset.
> > + ^ self utcMicroseconds: timeArray first offset: timeArray second]
> > + on: Error
> > + do: [ ""Use old style primitive support""
> > + ^self nowWithOffset: self localOffset]"!
> > - | clockAndOffset |
> > - clockAndOffset := self clock localMicrosecondClockWithOffset.
> > - (self automaticTimezone and:
> > - [self localOffset asSeconds ~= clockAndOffset second])
> > - ifTrue: [self localOffset: (Duration seconds: clockAndOffset second)].
> > - ^self now: clockAndOffset first offset: self localOffset!
> >
> > Item was changed:
> >   ----- Method: DateAndTime class>>year:month:day:hour:minute:second:nanoSecond:offset: (in category 'squeak protocol') -----
> >   year: year month: month day: day hour: hour minute: minute second: second nanoSecond: nanoCount offset: offset
> >   "Return a DateAndTime"
> >  
> > + ^ LXDateAndTime year: year month: month day: day hour: hour minute: minute second: second nanoSecond: nanoCount offset: offset
> > + " | monthIndex daysInMonth p q r s julianDayNumber |
> > - | monthIndex daysInMonth p q r s julianDayNumber |
> >  
> >   monthIndex := month isInteger ifTrue: [month] ifFalse: [Month indexOfMonth: month].
> >   daysInMonth := Month
> >   daysInMonth: monthIndex
> >   forYear: year.
> >   day < 1 ifTrue: [self error: 'day may not be zero or negative'].
> >   day > daysInMonth ifTrue: [self error: 'day is after month ends'].
> >  
> >   p := (monthIndex - 14) quo: 12.
> >   q := year + 4800 + p.
> >   r := monthIndex - 2 - (12 * p).
> >   s := (year + 4900 + p) quo: 100.
> >  
> >   julianDayNumber :=
> >     ( (1461 * q) quo: 4 ) +
> >   ( (367 * r) quo: 12 ) -
> >     ( (3 * s) quo: 4 ) +
> >     ( day - 32075 ).
> >  
> >   ^self basicNew
> >   setJdn: julianDayNumber
> >   seconds: hour * 60 + minute * 60 + second
> >   nano: nanoCount
> >   offset: offset;
> > + yourself"!
> > - yourself!
> >
> > Item was added:
> > + ----- Method: LXDateAndTime>>floor (in category 'squeak protocol') -----
> > + floor
> > + "Answer a copy with magnitude rounded down to the nearest whole second"
> > + ^self class
> > + utcMicroseconds: utcMicroseconds - (utcMicroseconds \\ 1000000)
> > + offset: localOffsetSeconds!
> >
> > Item was changed:
> >   ----- Method: TimeStamp class>>current (in category 'squeak protocol') -----
> >   current
> >  
> > + ^self now!
> > - | ts ticks |
> > - ts := super now asTimeStamp.
> > - ticks := ts ticks.
> > - ticks at: 3 put: 0.
> > - ts ticks: ticks offset: ts offset.
> > - ^ ts
> > - !
> >
> > Item was removed:
> > - ----- Method: TimeStamp class>>now (in category 'ansi protocol') -----
> > - now
> > - "Answer the current date and time as a TimeStamp."
> > -
> > - ^self current!
> >
> > Item was changed:
> >   ----- Method: Timespan class>>defaultOffset (in category 'configuring') -----
> >   defaultOffset
> > + "Timespans created in the context of an offset will start in that offset.  When no context is available, the defaultOffset for Timespans must be zero.  For example, two ways to make a Date for today:
> > + Date today.  'start is midnight at offset zero.  Will compare successfully to other Date today results.'
> > + DateAndTime now asDate.  'In this case, the start is midnight of the local time-zone.  It can only compare equally to Dates of its time-zone.'"
> > + ^ Duration zero!
> > - "Timespans created in the context of an offset will start in that offset.  When no context is available, the defaultOffset for Timespans must be nil.  For example, two ways to make a Date for today:
> > - Date today.  'start is midnight without offset.  Will compare successfully to other Date today results.'
> > - DateAndTime now asDate.  'In this case, the start is midnight of the local time-zone.  It can only compare equally to Dates of its time-zone or Dates without timezone.'"
> > - ^ nil!
> >
> > Item was changed:
> > + (PackageInfo named: 'Chronology-Core') postscript: '"Convert all instances of DateAndTime and TimeStamp to the equivalent LXDateAndTime and LXTimeStamp."
> > - (PackageInfo named: 'Chronology-Core') postscript: '"Ensure that the object history mark process uses DateAndTime>>floor rather than an earlier implementation that relied on a named instance variable."
> >  
> > + | oldInstances newInstances |
> > + Smalltalk garbageCollect.
> > + oldInstances := DateAndTime allInstances, TimeStamp allInstances.
> > + newInstances := oldInstances collect: [ :each |
> > +         each class == DateAndTime
> > +                 ifTrue: [ each asLXDateAndTime ]
> > +                 ifFalse: [ each asLXTimeStamp ] ].
> > + oldInstances elementsForwardIdentityTo: newInstances.
> > + Smalltalk garbageCollect.
> > +
> > + "Ensure that the object history mark process uses DateAndTime>>floor rather than an earlier implementation that relied on a named instance variable."
> > +
> >   Smalltalk at: #ObjectHistory ifPresent: [ :cls | cls current restartMarkProcess ].
> >   '!
> >
> >
>