--- a/AbstractTime.st Thu May 21 16:44:23 1998 +0200
+++ b/AbstractTime.st Fri May 22 12:47:19 1998 +0200
@@ -230,7 +230,7 @@
t1 := AbsoluteTime now.
(Delay forSeconds:5) wait.
t2 := AbsoluteTime now.
- 'seconds passed: ' print. (t2 - t1) printNL.
+ Transcript showCR:('seconds passed: ' , (t2 - t1) printString).
"
!
@@ -243,9 +243,20 @@
|t|
t := AbsoluteTime now.
+ Transcript showCR:t.
t printNL.
- (t addHours:50) printNL
+ Transcript showCR:(t addHours:12).
+ "
+
"
+ |t|
+
+ t := Time now.
+ Transcript showCR:t.
+ t printNL.
+ Transcript showCR:(t addHours:12).
+ "
+
!
addMinutes:numberOfMinutes
@@ -256,32 +267,57 @@
"
|t|
- t := AbsoluteTime now. t printNL. (t addMinutes:50) printNL
+ t := AbsoluteTime now.
+ Transcript showCR:t.
+ t printNL.
+ Transcript showCR:(t addMinutes:60).
+ "
- t := Time now. t printNL. (t addMinutes:50) printNL
+ "
+ |t|
+
+ t := Time now.
+ Transcript showCR:t.
+ t printNL.
+ Transcript showCR:(t addMinutes:60).
"
!
addSeconds:numberOfSeconds
"return a new instance of myself, numberOfSeconds afterwards."
- ^ self species basicNew setSeconds:(self getSeconds + numberOfSeconds)
+ ^ self species basicNew
+ setMilliseconds:(self getMilliseconds + (numberOfSeconds * 1000))
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ Transcript showCR:t.
+ t printNL.
+ Transcript showCR:(t addSeconds:60).
+ "
"
|t|
- t := AbsoluteTime now. t printNL. (t addSeconds:50) printNL.
+ t := Time now.
+ Transcript showCR:t.
+ t printNL.
+ Transcript showCR:(t addSeconds:60).
+ "
- t := Time now. t printNL. (t addSeconds:50) printNL
- "
!
addTime:timeAmount
"return a new instance of myself, timeAmount seconds afterwards.
- AddTime is a bad name - it does not add a time, but expects
- a number. Use any of addSeconds/addHours etc."
+ Provided for ST-80 compatibility.
+ WARNING:
+ AddTime is a bad name - it does not add a time, but expects
+ a numberOfSeconds as argument.
+ Use any of addSeconds/addHours etc. to make things clear"
- ^ self species basicNew setSeconds:(self getSeconds + timeAmount)
+ ^ self addSeconds:timeAmount
!
subtractHours:numberOfHours
@@ -293,8 +329,18 @@
|t|
t := AbsoluteTime now.
+ Transcript showCR:t.
t printNL.
- (t subtractHours:50) printNL
+ Transcript showCR:(t subtractHours:12).
+ "
+
+ "
+ |t|
+
+ t := Time now.
+ Transcript showCR:t.
+ t printNL.
+ Transcript showCR:(t subtractHours:12).
"
!
@@ -307,31 +353,57 @@
|t|
t := AbsoluteTime now.
+ Transcript showCR:t.
t printNL.
- (t subtractMinutes:50) printNL
+ Transcript showCR:(t subtractMinutes:60).
+ "
+
+ "
+ |t|
+
+ t := Time now.
+ Transcript showCR:t.
+ t printNL.
+ Transcript showCR:(t subtractMinutes:60).
"
!
subtractSeconds:numberOfSeconds
"return a new instance of myself, numberOfSeconds before."
- ^ self species basicNew setSeconds:(self getSeconds - numberOfSeconds)
+ ^ self species basicNew
+ setMilliseconds:(self getMilliseconds - (numberOfSeconds * 1000))
"
|t|
t := AbsoluteTime now.
+ Transcript showCR:t.
t printNL.
- (t subtractSeconds:50) printNL
+ Transcript showCR:(t subtractSeconds:60).
+ "
+
"
+ |t|
+
+ t := Time now.
+ Transcript showCR:t.
+ t printNL.
+ Transcript showCR:(t subtractSeconds:60).
+ "
+
!
subtractTime:timeAmount
- "return a new instance opf myself, timeAmount seconds before myself.
- SubtractTime is a bad name - it does not subtract a time, but expects
- a number. Use any of subtractSeconds/subtractHours etc."
+ "return a new instance of myself, timeAmount seconds before myself.
+ Provided for ST-80 compatibility.
+ WARNING:
+ SubtractTime is a bad name - it does not add a time, but expects
+ a numberOfSeconds as argument.
+ Use any of addSeconds/addHours etc. to make things clear"
- ^ self species basicNew setSeconds:(self getSeconds - timeAmount)
+ ^ self subtractSeconds:timeAmount
+
! !
!AbstractTime methodsFor:'private'!
@@ -383,5 +455,5 @@
!AbstractTime class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/AbstractTime.st,v 1.14 1997-01-29 18:01:17 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/AbstractTime.st,v 1.15 1998-05-22 10:47:19 cg Exp $'
! !