#BUGFIX by mawalch
authormawalch
Mon, 19 Mar 2018 12:50:49 +0100
changeset 22632 df853ecc851b
parent 22631 0d5b91cf33cd
child 22633 168193740976
#BUGFIX by mawalch class: AbstractTime added: #differenceFromTimestamp: Re-add.
AbstractTime.st
--- a/AbstractTime.st	Mon Mar 19 11:31:18 2018 +0100
+++ b/AbstractTime.st	Mon Mar 19 12:50:49 2018 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1995 by Claus Gittinger
               All Rights Reserved
@@ -608,6 +606,7 @@
     "
 ! !
 
+
 !AbstractTime methodsFor:'abstract'!
 
 hours
@@ -1154,6 +1153,23 @@
     ^ self subclassResponsibility
 ! !
 
+!AbstractTime methodsFor:'double dispatching'!
+
+differenceFromTimestamp:aTimestamp
+    "/ the correct thing to do (and I will, in the future) is to
+    "/ return a TimeDuration:
+    "/
+    ^ TimeDuration fromMilliseconds:(aTimestamp getMilliseconds - self getMilliseconds).
+
+    "/ which is the same as: deltaFrom:aTimestamp
+    "/
+    "/ however, there might be old code around, which is not be prepared for
+    "/ getting a non-number (the seconds). Therefore, for the meantime,
+    "/ we return:
+
+    "/ ^ aTimestamp getSeconds - self getSeconds
+! !
+
 
 !AbstractTime methodsFor:'printing & storing'!