LimitedPrecisionReal.st
changeset 11516 6103c6e90a56
parent 11225 32a2c7f432eb
child 11727 e0ffd06e50fd
--- a/LimitedPrecisionReal.st	Thu Feb 05 14:59:02 2009 +0100
+++ b/LimitedPrecisionReal.st	Thu Feb 05 14:59:22 2009 +0100
@@ -913,6 +913,23 @@
     ^ (aFraction numerator - (self * d)) / d
 !
 
+differenceFromTimestamp:aTimestamp
+    "I am to be interpreted as seconds, return the timestamp this number of seconds
+     before aTimestamp"
+
+    ^ aTimestamp subtractMilliseconds:(self * 1000) truncated.
+
+    "
+     Timestamp now differenceFromTimestamp:aTimestamp   
+     100.0 differenceFromTimestamp:Timestamp now 
+
+     |t1 t2|
+     t1 := Timestamp now. 
+     t2 := 1.5 differenceFromTimestamp:t1.
+     t1 inspect. t2 inspect.
+    "
+!
+
 productFromFraction:aFraction
     "sent when a fraction does not know how to multiply the receiver, a float"
 
@@ -1022,6 +1039,7 @@
    ^ 0
 ! !
 
+
 !LimitedPrecisionReal methodsFor:'testing'!
 
 isFinite
@@ -1149,7 +1167,7 @@
 !LimitedPrecisionReal class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/LimitedPrecisionReal.st,v 1.67 2008-10-19 11:12:42 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/LimitedPrecisionReal.st,v 1.68 2009-02-05 13:59:22 sr Exp $'
 ! !
 
 LimitedPrecisionReal initialize!