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

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

The Trunk: Chronology-Core-dtl.65.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.65.mcz

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

Name: Chronology-Core-dtl.65
Author: dtl
Time: 19 December 2020, 7:57:10.809501 pm
UUID: 7365f73a-d84f-4c6b-b8b6-16b6fb91194a
Ancestors: Chronology-Core-dtl.64

Ensure integral nanoseconds when printing DateAndTime to prevent error in e.g.
(DateAndTime fromSeconds: 3124074224.123456789s) printString

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

Item was changed:
  ----- Method: DateAndTime>>printOn:withLeadingSpace: (in category 'squeak protocol') -----
  printOn: aStream withLeadingSpace: printLeadingSpaceToo
  "Print as per ISO 8601 sections 5.3.3 and 5.4.1.
  If printLeadingSpaceToo is false, prints either:
  'YYYY-MM-DDThh:mm:ss.s+ZZ:zz:z' (for positive years) or '-YYYY-MM-DDThh:mm:ss.s+ZZ:zz:z' (for negative years)
  If printLeadingSpaceToo is true, prints either:
  ' YYYY-MM-DDThh:mm:ss.s+ZZ:zz:z' (for positive years) or '-YYYY-MM-DDThh:mm:ss.s+ZZ:zz:z' (for negative years)
  "
 
  | nanos offsetSeconds |
  self printYMDOn: aStream withLeadingSpace: printLeadingSpaceToo.
  aStream nextPut: $T.
  self printHMSOn: aStream.
  (nanos := utcMicroseconds \\ 1000000 * 1000) = 0 ifFalse: [
  | length |
  aStream nextPut: $..
  length := 9.
  [ nanos \\ 10 = 0 ] whileTrue: [
  nanos := nanos // 10.
  length := length - 1 ].
+ nanos asInteger printOn: aStream base: 10 length: length padded: true ].
- nanos printOn: aStream base: 10 length: length padded: true ].
  "Print offset"
  aStream nextPut: (localOffsetSeconds >= 0 ifTrue: [ $+ ] ifFalse: [ $- ]).
  offsetSeconds := localOffsetSeconds abs.
  offsetSeconds // 3600 printOn: aStream base: 10 length: 2 padded: true.
  aStream nextPut: $:.
  offsetSeconds \\ 3600 // 60 printOn: aStream base: 10 length: 2 padded: true.
  (offsetSeconds := offsetSeconds \\ 60) = 0 ifFalse: [
  aStream
  nextPut: $:;
  print: offsetSeconds ]!