#BUGFIX by cg
authorClaus Gittinger <cg@exept.de>
Thu, 10 May 2018 14:52:51 +0200
changeset 22866 43f44339eee0
parent 22865 77d1d90b53bc
child 22867 434085ae9420
#BUGFIX by cg class: TimeDuration changed: #abs #negated #setMilliseconds:
TimeDuration.st
--- a/TimeDuration.st	Thu May 10 14:39:53 2018 +0200
+++ b/TimeDuration.st	Thu May 10 14:52:51 2018 +0200
@@ -798,9 +798,7 @@
 !
 
 abs
-    ^ self class new 
-        setMilliseconds:(self getMilliseconds abs)
-        additionalPicoseconds:(additionalPicoseconds?0) abs
+    ^ self class new setMilliseconds:(self asExactMilliseconds abs)
 
     "
      (TimeDuration fromSeconds:3600) abs
@@ -812,9 +810,7 @@
 !
 
 negated
-    ^ self class new 
-        setMilliseconds:(self getMilliseconds) negated
-        additionalPicoseconds:(additionalPicoseconds?0) negated
+    ^ self class new setMilliseconds:(self asExactMilliseconds) negated
 
     "
      50 nanoseconds negated asNanoseconds
@@ -2035,14 +2031,11 @@
     "set my duration given milliseconds.
      Duration can be longer than a day"
 
-    |rest|
-
     millis isInteger ifTrue:[
         timeEncoding := millis.
     ] ifFalse:[
-        timeEncoding := millis truncated.
-        rest := millis - timeEncoding.
-        additionalPicoseconds := (rest * 1000 * 1000 * 1000) rounded asInteger.
+        timeEncoding := millis // 1.
+        additionalPicoseconds := ((millis \\ 1) * 1000 * 1000 * 1000) rounded asInteger.
     ]
 
     "Modified: / 18-07-2007 / 13:44:16 / cg"