AbsoluteTime.st
changeset 699 12f456343eea
parent 569 7134eb78cf48
child 795 ff477bad0f2d
--- a/AbsoluteTime.st	Thu Dec 07 22:24:46 1995 +0100
+++ b/AbsoluteTime.st	Thu Dec 07 22:32:39 1995 +0100
@@ -10,8 +10,6 @@
  hereby transferred.
 "
 
-'From Smalltalk/X, Version:2.10.4 on 8-feb-1995 at 12:46:45 pm'!
-
 AbstractTime subclass:#AbsoluteTime
 	 instanceVariableNames:'osTime'
 	 classVariableNames:''
@@ -35,10 +33,6 @@
 "
 !
 
-version
-    ^ '$Header: /cvs/stx/stx/libbasic/Attic/AbsoluteTime.st,v 1.17 1995-11-16 23:27:50 cg Exp $'
-!
-
 documentation
 "
     This class represents time values in seconds from 1st. Jan 1970, as
@@ -148,44 +142,6 @@
     "Modified: 16.11.1995 / 22:49:39 / cg"
 ! !
 
-!AbsoluteTime methodsFor:'private'!
-
-secondsLow
-    "strictly private: return the low part of the seconds"
-
-    ^ osTime at:1
-!
-
-secondsHi
-    "strictly private: return the hi part of the seconds"
-
-    ^ osTime at:2 
-!
-
-setSecondsLow:secsLow and:secsHi
-    "strictly private: set the seconds (since whatever)"
-
-    osTime := Array with:secsLow with:secsHi
-!
-
-setSeconds:secs
-    "strictly private: set the seconds (since whatever)"
-
-    osTime := Array with:(secs // 16r10000) with:(secs \\ 16r10000)
-!
-
-getSeconds
-    "strictly private: return the seconds (since whatever)"
-
-    ^ ((osTime at:2) * 16r10000) + (osTime at:1)
-!
-
-fromOSTimeLow:secsLow and:secsHi
-    "strictly private: set the seconds from an OS time (since whatever)"
-
-    osTime := Array with:secsLow with:secsHi
-! !
-
 !AbsoluteTime methodsFor:'accessing'!
 
 day
@@ -204,38 +160,6 @@
     "
 !
 
-month
-    "return the month of the receiver (1..12).
-     For compatibility, use instances of Date for this."
-
-    |m|
-
-    OperatingSystem computeDatePartsOf:osTime for:[ :year :month :day |
-	m := month
-    ].
-    ^ m
-
-    "
-     AbsoluteTime now month
-    "
-!
-
-year
-    "return the year of the receiver i.e. 1992.
-     For compatibility, use instances of Date for this."
-
-    |y|
-
-    OperatingSystem computeDatePartsOf:osTime for:[:year :month :day |
-	y := year
-    ].
-    ^ y
-
-    "
-     AbsoluteTime now year
-    "
-!
-
 hours
     "return the hours (0..23)"
 
@@ -268,6 +192,22 @@
 
 !
 
+month
+    "return the month of the receiver (1..12).
+     For compatibility, use instances of Date for this."
+
+    |m|
+
+    OperatingSystem computeDatePartsOf:osTime for:[ :year :month :day |
+	m := month
+    ].
+    ^ m
+
+    "
+     AbsoluteTime now month
+    "
+!
+
 seconds
     "return the seconds (0..59)"
 
@@ -282,99 +222,22 @@
      AbsoluteTime now seconds 
     "
 
-! !
-
-!AbsoluteTime methodsFor:'comparing'!
-
-> aTime
-    "return true if the argument, aTime is after the receiver"
-
-    |myHi otherHi|
-
-    myHi := self secondsHi. 
-    otherHi := aTime secondsHi.
-    myHi > otherHi ifTrue:[^ true].
-    myHi < otherHi ifTrue:[^ false].
-    ^ self secondsLow > aTime secondsLow
-!
-
-< aTime
-    "return true if the argument, aTime is before the receiver"
-
-    |myHi otherHi|
-
-    myHi := self secondsHi. 
-    otherHi := aTime secondsHi.
-    myHi < otherHi ifTrue:[^ true].
-    myHi > otherHi ifTrue:[^ false].
-    ^ self secondsLow < aTime secondsLow
-!
-
-= aTime
-    "return true if the argument, aTime represents the same time"
-
-    (aTime species == self species) ifFalse:[^ false].
-    ^ (self secondsLow == aTime secondsLow) and:[self secondsHi == aTime secondsHi]
 !
 
-hash
-    "return an integer useful for hashing on times"
-
-    ^ self getSeconds
-! !
-
-!AbsoluteTime methodsFor:'converting'!
+year
+    "return the year of the receiver i.e. 1992.
+     For compatibility, use instances of Date for this."
 
-asSeconds
-    "return the number of seconds elapsed since whatever time the
-     OperatingSystem bases its time upon. Since this is totally
-     OS-dependent, do not interpret the value returned by this method.
-     You can use it to add/subtract seconds or get time deltas, though."
+    |y|
 
-    ^ self getSeconds
+    OperatingSystem computeDatePartsOf:osTime for:[:year :month :day |
+	y := year
+    ].
+    ^ y
 
     "
-     AbsoluteTime now asSeconds
-     AbsoluteTime fromSeconds:(AbsoluteTime now asSeconds + 3600) 
-     Time hour:23 minutes:33 seconds:0         
-     Time fromSeconds:((Time hour:23 minutes:33 seconds:0) asSeconds + 3600) 
-    "
-!
-
-asDate
-    "return a Date object from the receiver.
-     The returned date will only represent the day - not the timeOfDay."
-
-    ^ Date fromOSTime:osTime 
-
-    "
-     AbsoluteTime now  
-     AbsoluteTime now asDate
-     (AbsoluteTime now addTime:3600) asDate 
-     (AbsoluteTime now addTime:3600) asTime 
-     AbsoluteTime fromSeconds:(AbsoluteTime now asSeconds + 3600) 
-     (AbsoluteTime fromSeconds:(AbsoluteTime now asSeconds + 3600)) asDate  
+     AbsoluteTime now year
     "
-
-!
-
-asTime
-    "return a Time object from the receiver.
-     The returned time will only represent the timeOfDay - not the day."
-
-    ^ Time fromOSTime:osTime
-
-    "
-     AbsoluteTime now  
-     AbsoluteTime now asTime
-     (AbsoluteTime now addTime:3600) asTime 
-    "
-!
-
-asAbsoluteTime
-    "return an AbsoluteTime object from the receiver - thats the receiver."
-
-    ^ self
 ! !
 
 !AbsoluteTime methodsFor:'arithmetic'!
@@ -413,6 +276,99 @@
     "
 ! !
 
+!AbsoluteTime methodsFor:'comparing'!
+
+< aTime
+    "return true if the argument, aTime is before the receiver"
+
+    |myHi otherHi|
+
+    myHi := self secondsHi. 
+    otherHi := aTime secondsHi.
+    myHi < otherHi ifTrue:[^ true].
+    myHi > otherHi ifTrue:[^ false].
+    ^ self secondsLow < aTime secondsLow
+!
+
+= aTime
+    "return true if the argument, aTime represents the same time"
+
+    (aTime species == self species) ifFalse:[^ false].
+    ^ (self secondsLow == aTime secondsLow) and:[self secondsHi == aTime secondsHi]
+!
+
+> aTime
+    "return true if the argument, aTime is after the receiver"
+
+    |myHi otherHi|
+
+    myHi := self secondsHi. 
+    otherHi := aTime secondsHi.
+    myHi > otherHi ifTrue:[^ true].
+    myHi < otherHi ifTrue:[^ false].
+    ^ self secondsLow > aTime secondsLow
+!
+
+hash
+    "return an integer useful for hashing on times"
+
+    ^ self getSeconds
+! !
+
+!AbsoluteTime methodsFor:'converting'!
+
+asAbsoluteTime
+    "return an AbsoluteTime object from the receiver - thats the receiver."
+
+    ^ self
+!
+
+asDate
+    "return a Date object from the receiver.
+     The returned date will only represent the day - not the timeOfDay."
+
+    ^ Date fromOSTime:osTime 
+
+    "
+     AbsoluteTime now  
+     AbsoluteTime now asDate
+     (AbsoluteTime now addTime:3600) asDate 
+     (AbsoluteTime now addTime:3600) asTime 
+     AbsoluteTime fromSeconds:(AbsoluteTime now asSeconds + 3600) 
+     (AbsoluteTime fromSeconds:(AbsoluteTime now asSeconds + 3600)) asDate  
+    "
+
+!
+
+asSeconds
+    "return the number of seconds elapsed since whatever time the
+     OperatingSystem bases its time upon. Since this is totally
+     OS-dependent, do not interpret the value returned by this method.
+     You can use it to add/subtract seconds or get time deltas, though."
+
+    ^ self getSeconds
+
+    "
+     AbsoluteTime now asSeconds
+     AbsoluteTime fromSeconds:(AbsoluteTime now asSeconds + 3600) 
+     Time hour:23 minutes:33 seconds:0         
+     Time fromSeconds:((Time hour:23 minutes:33 seconds:0) asSeconds + 3600) 
+    "
+!
+
+asTime
+    "return a Time object from the receiver.
+     The returned time will only represent the timeOfDay - not the day."
+
+    ^ Time fromOSTime:osTime
+
+    "
+     AbsoluteTime now  
+     AbsoluteTime now asTime
+     (AbsoluteTime now addTime:3600) asTime 
+    "
+! !
+
 !AbsoluteTime methodsFor:'printing & storing'!
 
 printOn:aStream
@@ -463,3 +419,47 @@
      AbsoluteTime readFrom:(AbsoluteTime now storeString) readStream
     "
 ! !
+
+!AbsoluteTime methodsFor:'private'!
+
+fromOSTimeLow:secsLow and:secsHi
+    "strictly private: set the seconds from an OS time (since whatever)"
+
+    osTime := Array with:secsLow with:secsHi
+!
+
+getSeconds
+    "strictly private: return the seconds (since whatever)"
+
+    ^ ((osTime at:2) * 16r10000) + (osTime at:1)
+!
+
+secondsHi
+    "strictly private: return the hi part of the seconds"
+
+    ^ osTime at:2 
+!
+
+secondsLow
+    "strictly private: return the low part of the seconds"
+
+    ^ osTime at:1
+!
+
+setSeconds:secs
+    "strictly private: set the seconds (since whatever)"
+
+    osTime := Array with:(secs // 16r10000) with:(secs \\ 16r10000)
+!
+
+setSecondsLow:secsLow and:secsHi
+    "strictly private: set the seconds (since whatever)"
+
+    osTime := Array with:secsLow with:secsHi
+! !
+
+!AbsoluteTime class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/libbasic/Attic/AbsoluteTime.st,v 1.18 1995-12-07 21:31:29 cg Exp $'
+! !