double dispatch for time-difference
authorsr
Thu, 05 Feb 2009 14:59:29 +0100
changeset 11517 e949ec17d9fc
parent 11516 6103c6e90a56
child 11518 8b4cafbd318a
double dispatch for time-difference
Integer.st
--- a/Integer.st	Thu Feb 05 14:59:22 2009 +0100
+++ b/Integer.st	Thu Feb 05 14:59:29 2009 +0100
@@ -2203,6 +2203,18 @@
     "Modified: 28.7.1997 / 19:08:30 / cg"
 !
 
+differenceFromTimestamp:aTimestamp
+    "I am to be interpreted as seconds, return the timestamp this number of seconds
+     before aTimestamp"
+
+    ^ aTimestamp subtractSeconds:self.
+
+    "
+     Timestamp now subtractSeconds:100  
+     100 differenceFromTimestamp:Timestamp now 
+    "
+!
+
 equalFromFraction:aFraction
     "that should never be invoked, as fractions are always normalized to integers
      if resulting from an arithmetic operation.
@@ -3539,6 +3551,7 @@
     "Modified: 15.10.1997 / 18:43:49 / cg"
 ! !
 
+
 !Integer methodsFor:'special bit operators'!
 
 bitAnd_32:anInteger
@@ -3955,7 +3968,7 @@
 !Integer class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Integer.st,v 1.215 2009-02-03 09:53:58 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Integer.st,v 1.216 2009-02-05 13:59:29 sr Exp $'
 ! !
 
 Integer initialize!