Timestamp.st
branchjv
changeset 17847 62aa54f44969
parent 17846 24edc476ac18
child 17850 8fa257692c35
--- a/Timestamp.st	Mon Jul 18 16:22:09 2011 +0100
+++ b/Timestamp.st	Wed Aug 10 15:59:08 2011 +0100
@@ -12,24 +12,24 @@
 "{ Package: 'stx:libbasic' }"
 
 AbstractTime subclass:#Timestamp
-        instanceVariableNames:'osTime'
-        classVariableNames:''
-        poolDictionaries:''
-        category:'Magnitude-Time'
+	instanceVariableNames:'osTime'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Magnitude-Time'
 !
 
 Object subclass:#TimestampBuilderAbstract
-        instanceVariableNames:'year month day hour minute second millisecond isUtcTime'
-        classVariableNames:''
-        poolDictionaries:''
-        privateIn:Timestamp
+	instanceVariableNames:'year month day hour minute second millisecond isUtcTime'
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:Timestamp
 !
 
 Timestamp::TimestampBuilderAbstract subclass:#TimestampISO8601Builder
-        instanceVariableNames:'stream'
-        classVariableNames:''
-        poolDictionaries:''
-        privateIn:Timestamp
+	instanceVariableNames:'stream'
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:Timestamp
 !
 
 !Timestamp class methodsFor:'documentation'!
@@ -956,7 +956,6 @@
     "Modified: / 05-10-2010 / 16:05:32 / cg"
 ! !
 
-
 !Timestamp methodsFor:'accessing'!
 
 day
@@ -1475,6 +1474,27 @@
     "
 ! !
 
+!Timestamp methodsFor:'double dispatching'!
+
+differenceFromTimestamp:aTimestamp
+    "/ the correct thing to do (and I will, in the future) is to
+    "/ return a TimeDuration:
+    "/
+    "/ ^ TimeDuration fromMilliseconds:(self getMilliseconds - (aTimestamp getMilliseconds))
+    "/ which is the same as: deltaFrom:aTimestamp
+    "/
+    "/ however, there might me old code around, which might not be prepared for
+    "/ getting a non-number (the seconds). Therefore, for the meantime,
+    "/ we return:
+
+    ^ aTimestamp getSeconds - self getSeconds
+    "/ which is the same as: secondDeltaFrom:aTimestamp
+
+    "/ be prepared for a change here.
+
+    "Created: / 01-08-2011 / 16:38:10 / cg"
+! !
+
 !Timestamp methodsFor:'initialization'!
 
 year:y month:m day:d hour:h minute:min second:s millisecond:millis 
@@ -1488,6 +1508,7 @@
                 millis:millis
 ! !
 
+
 !Timestamp methodsFor:'printing & storing'!
 
 addPrintBindingsTo:dict language:languageOrNil
@@ -1850,8 +1871,6 @@
     "
 ! !
 
-
-
 !Timestamp methodsFor:'testing'!
 
 isTimestamp
@@ -2640,11 +2659,12 @@
 !Timestamp class methodsFor:'documentation'!
 
 version
-    ^ '$Id: Timestamp.st 10660 2011-07-18 15:22:09Z vranyj1 $'
+    ^ '$Id: Timestamp.st 10665 2011-08-10 14:59:08Z vranyj1 $'
 !
 
 version_CVS
-    ^ '§Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.136 2011/01/24 19:59:15 stefan Exp §'
+    ^ '§Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.138 2011/08/01 14:40:24 cg Exp §'
 ! !
 
 Timestamp initialize!
+