The Inbox: Chronology-Core-dtl.60.mcz

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

The Inbox: Chronology-Core-dtl.60.mcz

commits-2
A new version of Chronology-Core was added to project The Inbox:
http://source.squeak.org/inbox/Chronology-Core-dtl.60.mcz

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

Name: Chronology-Core-dtl.60
Author: dtl
Time: 8 September 2020, 7:42:44.062725 pm
UUID: afcc86c3-7fb2-4ecd-b9ae-9840f100393c
Ancestors: Chronology-Core-ul.58

Fix Time>>addSeconds: to maintain nanoseconds.

=============== Diff against Chronology-Core-ul.58 ===============

Item was changed:
  ----- Method: Time>>addSeconds: (in category 'smalltalk-80') -----
  addSeconds: nSeconds
  "Answer a Time that is nSeconds after the receiver."
 
+ | secondsToAdd newNanos |
+ (secondsToAdd := nSeconds truncated) = nSeconds
+ ifTrue: [newNanos := nanos]
+ ifFalse: [(newNanos := nanos + (nSeconds - secondsToAdd * NanosInSecond)) > NanosInSecond
+ ifTrue: [secondsToAdd := secondsToAdd + 1.
+ newNanos := newNanos - NanosInSecond]].
+ ^ self class seconds: seconds + secondsToAdd nanoSeconds: newNanos!
- ^ self class seconds: self asSeconds + nSeconds!