TimeDuration.st
changeset 22887 4ed210df350c
parent 22870 c629e025c96b
child 22891 ac18d6513ef8
--- a/TimeDuration.st	Thu May 10 23:55:17 2018 +0200
+++ b/TimeDuration.st	Thu May 10 23:55:25 2018 +0200
@@ -1393,7 +1393,9 @@
 differenceFromTimestamp:aTimestamp
     "return the timestamp this timeDuration before aTimestamp"
 
-    ^ aTimestamp subtractMilliseconds:(self getMilliseconds)
+    ^ aTimestamp speciesNew "/ to get the UTC-offset, if any
+        setMilliseconds:(aTimestamp getMilliseconds - self getMilliseconds)
+        additionalPicoseconds:(aTimestamp additionalPicoseconds - self additionalPicoseconds)
 !
 
 productFromNumber:aNumber
@@ -1406,6 +1408,10 @@
 
     "
      5.1 * (TimeDuration fromString:'10s') 
+     (TimeDuration fromString:'10s') * 5.1
+
+     5.1 * (TimeDuration fromString:'10ns') 
+     (TimeDuration fromString:'10ns') * 5.1
     "
 
     "Modified (comment): / 12-06-2017 / 20:50:51 / cg"
@@ -1414,7 +1420,9 @@
 sumFromTimestamp:aTimestamp
     "return the timestamp this timeDuration after aTimestamp"
 
-    ^ aTimestamp addMilliseconds:(self getMilliseconds)
+    ^ aTimestamp speciesNew "/ to get the UTC-offset, if any
+        setMilliseconds:(self getMilliseconds + aTimestamp getMilliseconds)
+        additionalPicoseconds:(self additionalPicoseconds + aTimestamp additionalPicoseconds)
 ! !
 
 !TimeDuration methodsFor:'printing'!