#BUGFIX by cg
authorClaus Gittinger <cg@exept.de>
Fri, 11 May 2018 01:10:10 +0200
changeset 22891 ac18d6513ef8
parent 22890 0401fecb9c89
child 22892 aaf413123349
#BUGFIX by cg class: TimeDuration changed: #setNanoseconds:
TimeDuration.st
--- 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
     "