--- a/Time.st Thu Nov 27 11:04:50 2014 +0100
+++ b/Time.st Thu Nov 27 11:08:43 2014 +0100
@@ -545,31 +545,91 @@
< aTime
"return true if the receiver is before the argument"
+ |milliseconds|
+
aTime class == self class ifTrue:[
- ^ timeEncoding < aTime timeEncoding
+ ^ timeEncoding < aTime timeEncoding
+ ].
+ aTime isNumber ifTrue:[
+ "backward compatibility for old code, which expects (time1 - time2) to return seconds"
+ milliseconds := (aTime * 1000) asInteger. "integer seconds"
+ ] ifFalse:[
+ milliseconds := aTime getMilliseconds.
].
- ^ self getMilliseconds < aTime getMilliseconds
+ ^ self getMilliseconds < milliseconds
+
+ "
+ (Timestamp now + 10) - Timestamp now < 10
+ (Timestamp now + 10) - Timestamp now < 11
+ "
+!
+
+<= aTime
+ "return true if the receiver is before the argument"
+
+ |milliseconds|
+
+ aTime class == self class ifTrue:[
+ ^ timeEncoding <= aTime timeEncoding
+ ].
+ aTime isNumber ifTrue:[
+ "backward compatibility for old code, which expects (time1 - time2) to return seconds"
+ milliseconds := (aTime * 1000) asInteger. "integer seconds"
+ ] ifFalse:[
+ milliseconds := aTime getMilliseconds.
+ ].
+ ^ self getMilliseconds <= milliseconds
+
+ "
+ (Timestamp now + 10) - Timestamp now <= 10
+ (Timestamp now + 10) - Timestamp now <= 11
+ (Timestamp now + 10) - Timestamp now <= 9
+ "
!
= aTime
"return true if the argument, aTime represents the same timeOfDay"
+ |milliseconds|
+
aTime class == self class ifTrue:[
- ^ timeEncoding = aTime timeEncoding
+ ^ timeEncoding = aTime timeEncoding
].
- (aTime species == self species) ifFalse:[^ false].
- ^ self getMilliseconds = aTime getMilliseconds
+ aTime isNumber ifTrue:[
+ "backward compatibility for old code, which expects (time1 - time2) to return seconds"
+ milliseconds := (aTime * 1000) asInteger. "integer seconds"
+ ] ifFalse:[
+ aTime species == self species ifFalse:[^ false].
+ milliseconds := aTime getMilliseconds.
+ ].
+ ^ self getMilliseconds = milliseconds
- "Modified: / 18-07-2007 / 14:16:34 / cg"
+ "
+ (Timestamp now + 10) - Timestamp now = 10
+ (Timestamp now + 10) - Timestamp now = 9
+ "
!
> aTime
"return true if the receiver is before the argument"
+ |milliseconds|
+
aTime class == self class ifTrue:[
- ^ timeEncoding > aTime timeEncoding
+ ^ timeEncoding > aTime timeEncoding
].
- ^ self getMilliseconds > aTime getMilliseconds
+ aTime isNumber ifTrue:[
+ "backward compatibility for old code, which expects (time1 - time2) to return seconds"
+ milliseconds := (aTime * 1000) asInteger. "integer seconds"
+ ] ifFalse:[
+ milliseconds := aTime getMilliseconds.
+ ].
+ ^ self getMilliseconds > milliseconds
+
+ "
+ (Timestamp now + 10) - Timestamp now > 10
+ (Timestamp now + 10) - Timestamp now > 9
+ "
!
hash
@@ -589,8 +649,8 @@
todayTimestamp := Timestamp now.
todayTimestamp year:todayTimestamp year month:todayTimestamp month day:todayTimestamp day
- hour:(self hours) minute:(self minutes) second:(self seconds)
- millisecond:(self milliseconds).
+ hour:(self hours) minute:(self minutes) second:(self seconds)
+ millisecond:(self milliseconds).
^ todayTimestamp.
@@ -599,31 +659,6 @@
"
!
-asMilliseconds
- "return the number of milliseconds elapsed since midnight"
-
- ^ self getMilliseconds
-
- "
- Time now asMilliSeconds
- (TimeDuration days:1) asMilliSeconds
- (TimeDuration hours:1) asMilliSeconds
- "
-
- "Created: / 05-09-2011 / 10:40:15 / cg"
-!
-
-asSeconds
- "return the number of seconds elapsed since midnight"
-
- ^ self getSeconds
-
- "
- Time now asSeconds
- (TimeDuration days:1) asSeconds
- "
-!
-
asTime
"return a Time object from the receiver - that's the receiver."
@@ -917,10 +952,10 @@
!Time class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Time.st,v 1.100 2014-11-26 09:49:45 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Time.st,v 1.101 2014-11-27 10:08:43 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Time.st,v 1.100 2014-11-26 09:49:45 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Time.st,v 1.101 2014-11-27 10:08:43 stefan Exp $'
! !