--- a/AbsTime.st Wed Feb 08 04:11:17 1995 +0100
+++ b/AbsTime.st Sat Feb 11 15:07:56 1995 +0100
@@ -23,7 +23,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/Attic/AbsTime.st,v 1.8 1995-02-08 03:10:47 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/AbsTime.st,v 1.9 1995-02-11 14:07:56 claus Exp $
'!
!AbsoluteTime class methodsFor:'documentation'!
@@ -44,7 +44,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/Attic/AbsTime.st,v 1.8 1995-02-08 03:10:47 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/AbsTime.st,v 1.9 1995-02-11 14:07:56 claus Exp $
"
!
@@ -81,8 +81,8 @@
"return an instance of the receiver"
^ self fromOSTime:(OperatingSystem
- computeTimePartsFromYear:y month:m day:d
- hour:h minute:min seconds:s)
+ computeTimePartsFromYear:y month:m day:d
+ hour:h minute:min seconds:s)
"
AbsoluteTime day:2 month:1 year:1991 hour:12 minutes:30 seconds:0
@@ -143,9 +143,9 @@
|m|
OperatingSystem computeTimePartsOf:secondsLow and:secondsHi for:[
- :hours :minutes :secs |
+ :hours :minutes :secs |
- m := minutes
+ m := minutes
].
^ m
@@ -161,9 +161,9 @@
|s|
OperatingSystem computeTimePartsOf:secondsLow and:secondsHi for:[
- :hours :minutes :secs |
+ :hours :minutes :secs |
- s := secs
+ s := secs
].
^ s
@@ -180,8 +180,8 @@
|d|
OperatingSystem computeDatePartsOf:secondsLow and:secondsHi
- for:[:year :month :day |
- d := day
+ for:[:year :month :day |
+ d := day
].
^ d
@@ -197,8 +197,8 @@
|m|
OperatingSystem computeDatePartsOf:secondsLow and:secondsHi
- for:[:year :month :day |
- m := month
+ for:[:year :month :day |
+ m := month
].
^ m
@@ -214,8 +214,8 @@
|y|
OperatingSystem computeDatePartsOf:secondsLow and:secondsHi
- for:[:year :month :day |
- y := year
+ for:[:year :month :day |
+ y := year
].
^ y
@@ -230,9 +230,9 @@
|hr|
OperatingSystem computeTimePartsOf:secondsLow and:secondsHi for:[
- :hours :minutes :secs |
+ :hours :minutes :secs |
- hr := hours
+ hr := hours
].
^ hr
@@ -248,9 +248,9 @@
|m|
OperatingSystem computeTimePartsOf:secondsLow and:secondsHi for:[
- :hours :minutes :secs |
+ :hours :minutes :secs |
- m := minutes
+ m := minutes
].
^ m
@@ -266,9 +266,9 @@
|s|
OperatingSystem computeTimePartsOf:secondsLow and:secondsHi for:[
- :hours :minutes :secs |
+ :hours :minutes :secs |
- s := secs
+ s := secs
].
^ s
@@ -351,19 +351,135 @@
!AbsoluteTime methodsFor:'arithmetic'!
- aTime
- "return delta in seconds between 2 times/dates."
+ "return the delta in seconds between 2 times."
^ self getSeconds - (aTime getSeconds)
!
+addSeconds:numberOfSeconds
+ "return a new instance of myself, numberOfSeconds afterwards."
+
+ ^ self class new setSeconds:(self getSeconds + numberOfSeconds)
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t addSeconds:50) printNL
+ "
+!
+
+addMinutes:numberOfMinutes
+ "return a new instance of myself, numberOfMinutes afterwards."
+
+ ^ self addSeconds:(numberOfMinutes * 60)
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t addMinutes:50) printNL
+ "
+!
+
+addHours:numberOfHours
+ "return a new instance of myself, numberOfHours afterwards."
+
+ ^ self addSeconds:(numberOfHours * (60 * 60))
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t addHours:50) printNL
+ "
+!
+
+addDays:numberOfDays
+ "return a new instance of myself, numberOfDays afterwards."
+
+ ^ self addSeconds:(numberOfDays * (60 * 60 * 24))
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t addDays:7) printNL
+ "
+!
+
+subtractSeconds:numberOfSeconds
+ "return a new instance of myself, numberOfSeconds before."
+
+ ^ self class new setSeconds:(self getSeconds - numberOfSeconds)
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t subtractSeconds:50) printNL
+ "
+!
+
+subtractMinutes:numberOfMinutes
+ "return a new instance of myself, numberOfMinutes before."
+
+ ^ self subtractSeconds:(numberOfMinutes * 60)
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t subtractMinutes:50) printNL
+ "
+!
+
+subtractHours:numberOfHours
+ "return a new instance of myself, numberOfHours before."
+
+ ^ self subtractSeconds:(numberOfHours * (60 * 60))
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t subtractHours:50) printNL
+ "
+!
+
+subtractDays:numberOfDays
+ "return a new instance of myself, numberOfDays before."
+
+ ^ self subtractSeconds:(numberOfDays * (60 * 60 * 24))
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t subtractDays:50) printNL
+ "
+!
+
addTime:timeAmount
- "return a new instance of myself, timeAmount seconds afterwards"
+ "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."
^ self class new setSeconds:(self getSeconds + timeAmount)
!
subtractTime:timeAmount
- "return a new instance opf myself, timeAmount seconds before myself"
+ "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."
^ self class new setSeconds:(self getSeconds - timeAmount)
! !
@@ -374,10 +490,10 @@
|h min s d m y|
OperatingSystem computeDatePartsOf:secondsLow and:secondsHi for:[
- :year :month :day | d := day. m := month. y := year.
+ :year :month :day | d := day. m := month. y := year.
].
OperatingSystem computeTimePartsOf:secondsLow and:secondsHi for:[
- :hours :minutes :secs | h := hours. min := minutes. s := secs.
+ :hours :minutes :secs | h := hours. min := minutes. s := secs.
].
d printOn:aStream.
aStream nextPut:$-.
@@ -401,8 +517,8 @@
storeOn:aStream
aStream nextPut:$(;
- nextPutAll:self class name;
- nextPutAll:' new setSecondsLow:'.
+ nextPutAll:self class name;
+ nextPutAll:' new setSecondsLow:'.
secondsLow storeOn:aStream.
aStream nextPutAll:' and:'.
secondsHi storeOn:aStream.
--- a/AbsoluteTime.st Wed Feb 08 04:11:17 1995 +0100
+++ b/AbsoluteTime.st Sat Feb 11 15:07:56 1995 +0100
@@ -23,7 +23,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/Attic/AbsoluteTime.st,v 1.8 1995-02-08 03:10:47 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/AbsoluteTime.st,v 1.9 1995-02-11 14:07:56 claus Exp $
'!
!AbsoluteTime class methodsFor:'documentation'!
@@ -44,7 +44,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/Attic/AbsoluteTime.st,v 1.8 1995-02-08 03:10:47 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/AbsoluteTime.st,v 1.9 1995-02-11 14:07:56 claus Exp $
"
!
@@ -81,8 +81,8 @@
"return an instance of the receiver"
^ self fromOSTime:(OperatingSystem
- computeTimePartsFromYear:y month:m day:d
- hour:h minute:min seconds:s)
+ computeTimePartsFromYear:y month:m day:d
+ hour:h minute:min seconds:s)
"
AbsoluteTime day:2 month:1 year:1991 hour:12 minutes:30 seconds:0
@@ -143,9 +143,9 @@
|m|
OperatingSystem computeTimePartsOf:secondsLow and:secondsHi for:[
- :hours :minutes :secs |
+ :hours :minutes :secs |
- m := minutes
+ m := minutes
].
^ m
@@ -161,9 +161,9 @@
|s|
OperatingSystem computeTimePartsOf:secondsLow and:secondsHi for:[
- :hours :minutes :secs |
+ :hours :minutes :secs |
- s := secs
+ s := secs
].
^ s
@@ -180,8 +180,8 @@
|d|
OperatingSystem computeDatePartsOf:secondsLow and:secondsHi
- for:[:year :month :day |
- d := day
+ for:[:year :month :day |
+ d := day
].
^ d
@@ -197,8 +197,8 @@
|m|
OperatingSystem computeDatePartsOf:secondsLow and:secondsHi
- for:[:year :month :day |
- m := month
+ for:[:year :month :day |
+ m := month
].
^ m
@@ -214,8 +214,8 @@
|y|
OperatingSystem computeDatePartsOf:secondsLow and:secondsHi
- for:[:year :month :day |
- y := year
+ for:[:year :month :day |
+ y := year
].
^ y
@@ -230,9 +230,9 @@
|hr|
OperatingSystem computeTimePartsOf:secondsLow and:secondsHi for:[
- :hours :minutes :secs |
+ :hours :minutes :secs |
- hr := hours
+ hr := hours
].
^ hr
@@ -248,9 +248,9 @@
|m|
OperatingSystem computeTimePartsOf:secondsLow and:secondsHi for:[
- :hours :minutes :secs |
+ :hours :minutes :secs |
- m := minutes
+ m := minutes
].
^ m
@@ -266,9 +266,9 @@
|s|
OperatingSystem computeTimePartsOf:secondsLow and:secondsHi for:[
- :hours :minutes :secs |
+ :hours :minutes :secs |
- s := secs
+ s := secs
].
^ s
@@ -351,19 +351,135 @@
!AbsoluteTime methodsFor:'arithmetic'!
- aTime
- "return delta in seconds between 2 times/dates."
+ "return the delta in seconds between 2 times."
^ self getSeconds - (aTime getSeconds)
!
+addSeconds:numberOfSeconds
+ "return a new instance of myself, numberOfSeconds afterwards."
+
+ ^ self class new setSeconds:(self getSeconds + numberOfSeconds)
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t addSeconds:50) printNL
+ "
+!
+
+addMinutes:numberOfMinutes
+ "return a new instance of myself, numberOfMinutes afterwards."
+
+ ^ self addSeconds:(numberOfMinutes * 60)
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t addMinutes:50) printNL
+ "
+!
+
+addHours:numberOfHours
+ "return a new instance of myself, numberOfHours afterwards."
+
+ ^ self addSeconds:(numberOfHours * (60 * 60))
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t addHours:50) printNL
+ "
+!
+
+addDays:numberOfDays
+ "return a new instance of myself, numberOfDays afterwards."
+
+ ^ self addSeconds:(numberOfDays * (60 * 60 * 24))
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t addDays:7) printNL
+ "
+!
+
+subtractSeconds:numberOfSeconds
+ "return a new instance of myself, numberOfSeconds before."
+
+ ^ self class new setSeconds:(self getSeconds - numberOfSeconds)
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t subtractSeconds:50) printNL
+ "
+!
+
+subtractMinutes:numberOfMinutes
+ "return a new instance of myself, numberOfMinutes before."
+
+ ^ self subtractSeconds:(numberOfMinutes * 60)
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t subtractMinutes:50) printNL
+ "
+!
+
+subtractHours:numberOfHours
+ "return a new instance of myself, numberOfHours before."
+
+ ^ self subtractSeconds:(numberOfHours * (60 * 60))
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t subtractHours:50) printNL
+ "
+!
+
+subtractDays:numberOfDays
+ "return a new instance of myself, numberOfDays before."
+
+ ^ self subtractSeconds:(numberOfDays * (60 * 60 * 24))
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t subtractDays:50) printNL
+ "
+!
+
addTime:timeAmount
- "return a new instance of myself, timeAmount seconds afterwards"
+ "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."
^ self class new setSeconds:(self getSeconds + timeAmount)
!
subtractTime:timeAmount
- "return a new instance opf myself, timeAmount seconds before myself"
+ "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."
^ self class new setSeconds:(self getSeconds - timeAmount)
! !
@@ -374,10 +490,10 @@
|h min s d m y|
OperatingSystem computeDatePartsOf:secondsLow and:secondsHi for:[
- :year :month :day | d := day. m := month. y := year.
+ :year :month :day | d := day. m := month. y := year.
].
OperatingSystem computeTimePartsOf:secondsLow and:secondsHi for:[
- :hours :minutes :secs | h := hours. min := minutes. s := secs.
+ :hours :minutes :secs | h := hours. min := minutes. s := secs.
].
d printOn:aStream.
aStream nextPut:$-.
@@ -401,8 +517,8 @@
storeOn:aStream
aStream nextPut:$(;
- nextPutAll:self class name;
- nextPutAll:' new setSecondsLow:'.
+ nextPutAll:self class name;
+ nextPutAll:' new setSecondsLow:'.
secondsLow storeOn:aStream.
aStream nextPutAll:' and:'.
secondsHi storeOn:aStream.
--- a/Timestamp.st Wed Feb 08 04:11:17 1995 +0100
+++ b/Timestamp.st Sat Feb 11 15:07:56 1995 +0100
@@ -23,7 +23,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.8 1995-02-08 03:10:47 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.9 1995-02-11 14:07:56 claus Exp $
'!
!AbsoluteTime class methodsFor:'documentation'!
@@ -44,7 +44,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.8 1995-02-08 03:10:47 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.9 1995-02-11 14:07:56 claus Exp $
"
!
@@ -81,8 +81,8 @@
"return an instance of the receiver"
^ self fromOSTime:(OperatingSystem
- computeTimePartsFromYear:y month:m day:d
- hour:h minute:min seconds:s)
+ computeTimePartsFromYear:y month:m day:d
+ hour:h minute:min seconds:s)
"
AbsoluteTime day:2 month:1 year:1991 hour:12 minutes:30 seconds:0
@@ -143,9 +143,9 @@
|m|
OperatingSystem computeTimePartsOf:secondsLow and:secondsHi for:[
- :hours :minutes :secs |
+ :hours :minutes :secs |
- m := minutes
+ m := minutes
].
^ m
@@ -161,9 +161,9 @@
|s|
OperatingSystem computeTimePartsOf:secondsLow and:secondsHi for:[
- :hours :minutes :secs |
+ :hours :minutes :secs |
- s := secs
+ s := secs
].
^ s
@@ -180,8 +180,8 @@
|d|
OperatingSystem computeDatePartsOf:secondsLow and:secondsHi
- for:[:year :month :day |
- d := day
+ for:[:year :month :day |
+ d := day
].
^ d
@@ -197,8 +197,8 @@
|m|
OperatingSystem computeDatePartsOf:secondsLow and:secondsHi
- for:[:year :month :day |
- m := month
+ for:[:year :month :day |
+ m := month
].
^ m
@@ -214,8 +214,8 @@
|y|
OperatingSystem computeDatePartsOf:secondsLow and:secondsHi
- for:[:year :month :day |
- y := year
+ for:[:year :month :day |
+ y := year
].
^ y
@@ -230,9 +230,9 @@
|hr|
OperatingSystem computeTimePartsOf:secondsLow and:secondsHi for:[
- :hours :minutes :secs |
+ :hours :minutes :secs |
- hr := hours
+ hr := hours
].
^ hr
@@ -248,9 +248,9 @@
|m|
OperatingSystem computeTimePartsOf:secondsLow and:secondsHi for:[
- :hours :minutes :secs |
+ :hours :minutes :secs |
- m := minutes
+ m := minutes
].
^ m
@@ -266,9 +266,9 @@
|s|
OperatingSystem computeTimePartsOf:secondsLow and:secondsHi for:[
- :hours :minutes :secs |
+ :hours :minutes :secs |
- s := secs
+ s := secs
].
^ s
@@ -351,19 +351,135 @@
!AbsoluteTime methodsFor:'arithmetic'!
- aTime
- "return delta in seconds between 2 times/dates."
+ "return the delta in seconds between 2 times."
^ self getSeconds - (aTime getSeconds)
!
+addSeconds:numberOfSeconds
+ "return a new instance of myself, numberOfSeconds afterwards."
+
+ ^ self class new setSeconds:(self getSeconds + numberOfSeconds)
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t addSeconds:50) printNL
+ "
+!
+
+addMinutes:numberOfMinutes
+ "return a new instance of myself, numberOfMinutes afterwards."
+
+ ^ self addSeconds:(numberOfMinutes * 60)
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t addMinutes:50) printNL
+ "
+!
+
+addHours:numberOfHours
+ "return a new instance of myself, numberOfHours afterwards."
+
+ ^ self addSeconds:(numberOfHours * (60 * 60))
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t addHours:50) printNL
+ "
+!
+
+addDays:numberOfDays
+ "return a new instance of myself, numberOfDays afterwards."
+
+ ^ self addSeconds:(numberOfDays * (60 * 60 * 24))
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t addDays:7) printNL
+ "
+!
+
+subtractSeconds:numberOfSeconds
+ "return a new instance of myself, numberOfSeconds before."
+
+ ^ self class new setSeconds:(self getSeconds - numberOfSeconds)
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t subtractSeconds:50) printNL
+ "
+!
+
+subtractMinutes:numberOfMinutes
+ "return a new instance of myself, numberOfMinutes before."
+
+ ^ self subtractSeconds:(numberOfMinutes * 60)
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t subtractMinutes:50) printNL
+ "
+!
+
+subtractHours:numberOfHours
+ "return a new instance of myself, numberOfHours before."
+
+ ^ self subtractSeconds:(numberOfHours * (60 * 60))
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t subtractHours:50) printNL
+ "
+!
+
+subtractDays:numberOfDays
+ "return a new instance of myself, numberOfDays before."
+
+ ^ self subtractSeconds:(numberOfDays * (60 * 60 * 24))
+
+ "
+ |t|
+
+ t := AbsoluteTime now.
+ t printNL.
+ (t subtractDays:50) printNL
+ "
+!
+
addTime:timeAmount
- "return a new instance of myself, timeAmount seconds afterwards"
+ "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."
^ self class new setSeconds:(self getSeconds + timeAmount)
!
subtractTime:timeAmount
- "return a new instance opf myself, timeAmount seconds before myself"
+ "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."
^ self class new setSeconds:(self getSeconds - timeAmount)
! !
@@ -374,10 +490,10 @@
|h min s d m y|
OperatingSystem computeDatePartsOf:secondsLow and:secondsHi for:[
- :year :month :day | d := day. m := month. y := year.
+ :year :month :day | d := day. m := month. y := year.
].
OperatingSystem computeTimePartsOf:secondsLow and:secondsHi for:[
- :hours :minutes :secs | h := hours. min := minutes. s := secs.
+ :hours :minutes :secs | h := hours. min := minutes. s := secs.
].
d printOn:aStream.
aStream nextPut:$-.
@@ -401,8 +517,8 @@
storeOn:aStream
aStream nextPut:$(;
- nextPutAll:self class name;
- nextPutAll:' new setSecondsLow:'.
+ nextPutAll:self class name;
+ nextPutAll:' new setSecondsLow:'.
secondsLow storeOn:aStream.
aStream nextPutAll:' and:'.
secondsHi storeOn:aStream.