diff -r be947d4e7fb2 -r 514c749165c3 Time.st --- a/Time.st Mon Oct 10 01:29:01 1994 +0100 +++ b/Time.st Mon Oct 10 01:29:28 1994 +0100 @@ -1,6 +1,6 @@ " COPYRIGHT (c) 1989 by Claus Gittinger - All Rights Reserved + All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the @@ -19,9 +19,9 @@ Time comment:' COPYRIGHT (c) 1989 by Claus Gittinger - All Rights Reserved + All Rights Reserved -$Header: /cvs/stx/stx/libbasic/Time.st,v 1.10 1994-08-05 01:02:52 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Time.st,v 1.11 1994-10-10 00:28:55 claus Exp $ '! !Time class methodsFor:'documentation'! @@ -29,7 +29,7 @@ copyright " COPYRIGHT (c) 1989 by Claus Gittinger - All Rights Reserved + All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the @@ -42,7 +42,7 @@ version " -$Header: /cvs/stx/stx/libbasic/Time.st,v 1.10 1994-08-05 01:02:52 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Time.st,v 1.11 1994-10-10 00:28:55 claus Exp $ " ! @@ -58,7 +58,7 @@ "return an instance of Time representing this moment" ^ self basicNew setSecondsLow:(OperatingSystem getTimeLow) - and:(OperatingSystem getTimeHi) + and:(OperatingSystem getTimeHi) " Time now @@ -96,11 +96,11 @@ "return the number of seconds elapsed since midnight" OperatingSystem computeTimePartsOf:secondsLow and:secondsHi for:[ - :hours :minutes :seconds | + :hours :minutes :seconds | - ^ ( 3600 * hours ) - + ( 60 * minutes ) - + seconds + ^ ( 3600 * hours ) + + ( 60 * minutes ) + + seconds ] " @@ -143,11 +143,11 @@ > aTime "return true if the argument, aTime is after the receiver" - (aTime isMemberOf:Time) ifTrue:[ - (secondsHi > aTime secondsHi) ifTrue:[^ true]. - (secondsHi < aTime secondsHi) ifTrue:[^ false]. - (secondsLow > aTime secondsLow) ifTrue:[^ true]. - ^ false + (aTime respondsTo:#secondsLow) ifTrue:[ + (secondsHi > aTime secondsHi) ifTrue:[^ true]. + (secondsHi < aTime secondsHi) ifTrue:[^ false]. + (secondsLow > aTime secondsLow) ifTrue:[^ true]. + ^ false ]. ^ self getSeconds > aTime getSeconds ! @@ -155,22 +155,13 @@ < aTime "return true if the argument, aTime is before the receiver" - (aTime isMemberOf:Time) ifTrue:[ - (secondsHi < aTime secondsHi) ifTrue:[^ true]. - (secondsHi > aTime secondsHi) ifTrue:[^ false]. - (secondsLow < aTime secondsLow) ifTrue:[^ true]. - ^ false + (aTime respondsTo:#secondsLow) ifTrue:[ + (secondsHi < aTime secondsHi) ifTrue:[^ true]. + (secondsHi > aTime secondsHi) ifTrue:[^ false]. + (secondsLow < aTime secondsLow) ifTrue:[^ true]. + ^ false ]. ^ self getSeconds < aTime getSeconds -! - -= aTime - "return true if aTime represents the same time as the receiver" - - (aTime isMemberOf:Time) ifTrue:[ - ^ ((secondsLow == aTime secondsLow) and:[secondsHi == aTime secondsHi]) - ]. - ^ self getSeconds = aTime getSeconds ! ! !Time methodsFor:'printing & storing'! @@ -197,15 +188,15 @@ Format is hh:mm:ss in 24-hour format." OperatingSystem computeTimePartsOf:secondsLow and:secondsHi for:[ - :hours :minutes :secs | + :hours :minutes :secs | - hours printOn:aStream. - aStream nextPut:$:. - (minutes < 10) ifTrue:[aStream nextPut:$0]. - minutes printOn:aStream. - aStream nextPut:$:. - (secs < 10) ifTrue:[aStream nextPut:$0]. - secs printOn:aStream + hours printOn:aStream. + aStream nextPut:$:. + (minutes < 10) ifTrue:[aStream nextPut:$0]. + minutes printOn:aStream. + aStream nextPut:$:. + (secs < 10) ifTrue:[aStream nextPut:$0]. + secs printOn:aStream ] " @@ -218,7 +209,7 @@ Format is hh:mm:ss am/pm (i.e. 12-hour format)." OperatingSystem computeTimePartsOf:secondsLow and:secondsHi for:[ - :hours :minutes :secs | |h| + :hours :minutes :secs | |h| h := hours. h > 12 ifTrue:[ @@ -227,14 +218,14 @@ h < 1 ifTrue:[ h := 12 ] - ]. - h printOn:aStream. - aStream nextPut:$:. - (minutes < 10) ifTrue:[aStream nextPut:$0]. - minutes printOn:aStream. - aStream nextPut:$:. - (secs < 10) ifTrue:[aStream nextPut:$0]. - secs printOn:aStream. + ]. + h printOn:aStream. + aStream nextPut:$:. + (minutes < 10) ifTrue:[aStream nextPut:$0]. + minutes printOn:aStream. + aStream nextPut:$:. + (secs < 10) ifTrue:[aStream nextPut:$0]. + secs printOn:aStream. hours >= 12 ifTrue:[ aStream nextPutAll:' pm' ] ifFalse:[