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

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

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

Name: Chronology-Core-bf.7
Author: bf
Time: 8 July 2016, 11:47:29.911394 am
UUID: de32e02b-c9bb-43b6-acd3-c42c26188e28
Ancestors: Chronology-Core-cmm.6

Do not print nanoseconds unless requested

=============== Diff against Chronology-Core-cmm.6 ===============

Item was changed:
  ----- Method: Time>>print24:showSeconds:on: (in category 'printing') -----
  print24: hr24 showSeconds: showSeconds on: aStream
  "Format is 'hh:mm:ss' or 'h:mm:ss am'  or, if showSeconds is false, 'hh:mm' or 'h:mm am'"
 
+ ^self print24: hr24 showSeconds: showSeconds showSubseconds: false on: aStream !
- | h m s |
- h := self hour. m := self minute. s := self second.
- hr24
- ifTrue:
- [ h < 10 ifTrue: [ aStream nextPutAll: '0' ].
- h printOn: aStream ]
- ifFalse:
- [ h > 12
- ifTrue: [h - 12 printOn: aStream]
- ifFalse:
- [h < 1
- ifTrue: [ 12 printOn: aStream ]
- ifFalse: [ h printOn: aStream ]]].
-
- aStream nextPutAll: (m < 10 ifTrue: [':0'] ifFalse: [':']).
- m printOn: aStream.
-
- showSeconds ifTrue:
- [ aStream nextPutAll: (s < 10 ifTrue: [':0'] ifFalse: [':']).
- self nanoSecond = 0
- ifTrue: [s asInteger printOn: aStream]
- ifFalse: [s asInteger * NanosInSecond + self nanoSecond asInteger
- printOn: aStream asFixedPoint: NanosInSecond]].
-
- hr24 ifFalse:
- [ aStream nextPutAll: (h < 12 ifTrue: [' am'] ifFalse: [' pm']) ].
- !

Item was added:
+ ----- Method: Time>>print24:showSeconds:showSubseconds:on: (in category 'printing') -----
+ print24: hr24 showSeconds: showSeconds showSubseconds: showSubseconds on: aStream
+ "Format is 'hh:mm:ss' or 'h:mm:ss am'  or, if showSeconds is false, 'hh:mm' or 'h:mm am'.
+ If showSubseconds is true and our nanoSeconds are not zero, a decimal point and subseconds are added"
+
+ | h m s |
+ h := self hour. m := self minute. s := self second.
+ hr24
+ ifTrue:
+ [ h < 10 ifTrue: [ aStream nextPutAll: '0' ].
+ h printOn: aStream ]
+ ifFalse:
+ [ h > 12
+ ifTrue: [h - 12 printOn: aStream]
+ ifFalse:
+ [h < 1
+ ifTrue: [ 12 printOn: aStream ]
+ ifFalse: [ h printOn: aStream ]]].
+
+ aStream nextPutAll: (m < 10 ifTrue: [':0'] ifFalse: [':']).
+ m printOn: aStream.
+
+ showSeconds ifTrue:
+ [ aStream nextPutAll: (s < 10 ifTrue: [':0'] ifFalse: [':']).
+ (showSubseconds not or: [self nanoSecond = 0])
+ ifTrue: [s asInteger printOn: aStream]
+ ifFalse: [s asInteger * NanosInSecond + self nanoSecond asInteger
+ printOn: aStream asFixedPoint: NanosInSecond]].
+
+ hr24 ifFalse:
+ [ aStream nextPutAll: (h < 12 ifTrue: [' am'] ifFalse: [' pm']) ].
+ !

Item was changed:
  ----- Method: Time>>printOn: (in category 'printing') -----
  printOn: aStream
 
  self print24: false
  showSeconds: (self seconds ~= 0
  or: [self nanoSecond ~= 0])
+ showSubseconds: self nanoSecond ~= 0
  on: aStream!