--- a/TimeDuration.st Fri May 11 00:03:47 2018 +0200
+++ b/TimeDuration.st Fri May 11 01:10:10 2018 +0200
@@ -2089,20 +2089,25 @@
setNanoseconds:nanos
"set my duration given nanoseconds."
- |restNanos|
+ |millis restNanos|
+ millis := nanos // (1000*1000).
nanos isInteger ifTrue:[
- timeEncoding := nanos // 1000000.
- additionalPicoseconds := (nanos \\ 1000) * 1000
+ timeEncoding := millis.
+ restNanos := nanos \\ (1000*1000).
+ additionalPicoseconds := restNanos * 1000
] ifFalse:[
- timeEncoding := nanos // (1000*1000).
- restNanos := nanos - (timeEncoding * (1000*1000)).
+ timeEncoding := millis.
+ restNanos := nanos - (millis * (1000*1000)).
additionalPicoseconds := (restNanos * 1000) rounded asInteger.
].
"
self new setMicroseconds:4
self new setNanoseconds:4
+ self new setNanoseconds:4000
+ self new setNanoseconds:4000000
+ self new setNanoseconds:40000000
self new setNanoseconds:0.1
"