changed osTime to a largeInt, which includes the milliseconds
authorClaus Gittinger <cg@exept.de>
Mon, 01 Jul 1996 15:31:33 +0200
changeset 1500 d42e61e53cee
parent 1499 0df07e1d0c2f
child 1501 2589005c849d
changed osTime to a largeInt, which includes the milliseconds
AbstrTime.st
AbstractTime.st
--- a/AbstrTime.st	Mon Jul 01 15:26:33 1996 +0200
+++ b/AbstrTime.st	Mon Jul 01 15:31:33 1996 +0200
@@ -17,7 +17,7 @@
 	category:'Magnitude-General'
 !
 
-!AbstractTime class methodsFor:'documentation'!
+!AbstractTime  class methodsFor:'documentation'!
 
 copyright
 "
@@ -35,7 +35,9 @@
 
 documentation
 "
-    This is an abstract class; there are no instances in the system.
+    This is an abstract class providing common protocol for Time (time in day)
+    and AbsoluteTime (time plus day).
+    There are no instances of this class in the system.
     It is meant as a home for methods common to time handling classes.
 
     [author:]
@@ -47,7 +49,7 @@
 "
 ! !
 
-!AbstractTime class methodsFor:'instance creation'!
+!AbstractTime  class methodsFor:'instance creation'!
 
 dateAndTimeNow
     "return an array filled with the current date and time.
@@ -65,17 +67,17 @@
 now
     "return an instance of myself representing this moment."
 
-    ^ self basicNew fromOSTime:(OperatingSystem getTimeParts)
+    ^ self basicNew fromOSTime:(OperatingSystem getOSTime)
 
     "
      AbsoluteTime now   
      Time now   
     "
 
-    "Modified: 19.4.1996 / 15:24:00 / cg"
+    "Modified: 1.7.1996 / 15:20:10 / cg"
 ! !
 
-!AbstractTime class methodsFor:'ST-80 compatibility'!
+!AbstractTime  class methodsFor:'ST-80 compatibility'!
 
 totalSeconds
     "returns an internal second clock. Dont interpret the returned
@@ -85,41 +87,15 @@
     ^ self secondClock
 ! !
 
-!AbstractTime class methodsFor:'obsolete'!
-
-fromUnixTimeLow:low and:hi
-    "return an instance of myself, given the unix time.
-     Internal interface - not for public use."
-
-    ^ self fromOSTimeLow:low and:hi
-! !
-
-!AbstractTime class methodsFor:'private instance creation'!
+!AbstractTime  class methodsFor:'private instance creation'!
 
 fromOSTime:osTime
     "return a time, representing the time given by the operatingSystem time.
      Not meant for public use."
 
-    |low hi|
-
-    "now migrating to support LargeInteger OS-time handles ...
-     ... in the meantime, support both formats."
+    ^ self basicNew fromOSTime:osTime.
 
-    (osTime isMemberOf:Array) ifTrue:[
-	low := osTime at:1.
-	hi :=  osTime at:2.
-    ] ifFalse:[
-	low := osTime bitAnd:16rFFFF.
-	hi := (osTime bitShift:-16) bitAnd:16rFFFF.
-    ].
-    ^ self basicNew fromOSTimeLow:low and:hi
-!
-
-fromOSTimeLow:osTimeLow and:osTimeHigh
-    "return a time, representing the time given by the operatingSystem time.
-     Not meant for public use."
-
-    ^ self basicNew fromOSTimeLow:osTimeLow and:osTimeHigh
+    "Modified: 1.7.1996 / 15:09:54 / cg"
 !
 
 fromSeconds:seconds
@@ -136,12 +112,15 @@
      Time fromSeconds:0             should return midnight
      AbsoluteTime fromSeconds:0     on UNIX: returns 1st. Jan 1970
                                     on others: dont know
+     (AbsoluteTime day:1 month:1 year:1970 hour:1 minutes:0 seconds:0)
+        getSeconds                  on UNIX: returns 0
+                                    on others: dont know
     "
 
-    "Modified: 19.4.1996 / 15:22:28 / cg"
+    "Modified: 1.7.1996 / 13:39:30 / cg"
 ! !
 
-!AbstractTime class methodsFor:'queries'!
+!AbstractTime  class methodsFor:'queries'!
 
 millisecondClockValue
     "return the millisecond clock - since this one overruns
@@ -158,14 +137,16 @@
 secondClock
     "return seconds of now - for GNU-ST compatibility"
 
-    ^ OperatingSystem getTime
+    ^ OperatingSystem getOSTime // 1000
 
     "
      AbstractTime secondClock    
     "
+
+    "Modified: 1.7.1996 / 15:20:14 / cg"
 ! !
 
-!AbstractTime class methodsFor:'timing evaluations'!
+!AbstractTime  class methodsFor:'timing evaluations'!
 
 millisecondsToRun:aBlock
     "evaluate the argument, aBlock; return the number of milliseconds it took"
@@ -353,10 +334,12 @@
 
 !AbstractTime methodsFor:'private'!
 
-fromOSTime:timeParts
+fromOSTime:osTime
     "set my time, from operatingSystems time parts"
 
-    ^ self fromOSTimeLow:(timeParts at:1) and:(timeParts at:2)
+    ^ self subclassResponsibility
+
+    "Modified: 1.7.1996 / 15:09:44 / cg"
 !
 
 fromOSTimeTimeLow:lowTime and:hiTime
@@ -367,6 +350,16 @@
     ^ self subclassResponsibility
 !
 
+getMilliseconds
+    "get the milliseconds.
+     Since I am abstract (not knowing how the time is actually
+     represented), this must be done by a concrete class."
+
+    ^ self subclassResponsibility
+
+    "Created: 1.7.1996 / 14:16:49 / cg"
+!
+
 getSeconds
     "get the seconds.
      Since I am abstract (not knowing how the time is actually
@@ -375,6 +368,16 @@
     ^ self subclassResponsibility
 !
 
+setMilliseconds:millis
+    "set the milliseconds.
+     Since I am abstract (not knowing how the time is actually
+     represented), this must be done by a concrete class."
+
+    ^ self subclassResponsibility
+
+    "Created: 1.7.1996 / 14:17:00 / cg"
+!
+
 setSeconds:secs
     "set the seconds.
      Since I am abstract (not knowing how the time is actually
@@ -383,8 +386,8 @@
     ^ self subclassResponsibility
 ! !
 
-!AbstractTime class methodsFor:'documentation'!
+!AbstractTime  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Attic/AbstrTime.st,v 1.12 1996-06-17 15:18:40 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Attic/AbstrTime.st,v 1.13 1996-07-01 13:31:33 cg Exp $'
 ! !
--- a/AbstractTime.st	Mon Jul 01 15:26:33 1996 +0200
+++ b/AbstractTime.st	Mon Jul 01 15:31:33 1996 +0200
@@ -17,7 +17,7 @@
 	category:'Magnitude-General'
 !
 
-!AbstractTime class methodsFor:'documentation'!
+!AbstractTime  class methodsFor:'documentation'!
 
 copyright
 "
@@ -35,7 +35,9 @@
 
 documentation
 "
-    This is an abstract class; there are no instances in the system.
+    This is an abstract class providing common protocol for Time (time in day)
+    and AbsoluteTime (time plus day).
+    There are no instances of this class in the system.
     It is meant as a home for methods common to time handling classes.
 
     [author:]
@@ -47,7 +49,7 @@
 "
 ! !
 
-!AbstractTime class methodsFor:'instance creation'!
+!AbstractTime  class methodsFor:'instance creation'!
 
 dateAndTimeNow
     "return an array filled with the current date and time.
@@ -65,17 +67,17 @@
 now
     "return an instance of myself representing this moment."
 
-    ^ self basicNew fromOSTime:(OperatingSystem getTimeParts)
+    ^ self basicNew fromOSTime:(OperatingSystem getOSTime)
 
     "
      AbsoluteTime now   
      Time now   
     "
 
-    "Modified: 19.4.1996 / 15:24:00 / cg"
+    "Modified: 1.7.1996 / 15:20:10 / cg"
 ! !
 
-!AbstractTime class methodsFor:'ST-80 compatibility'!
+!AbstractTime  class methodsFor:'ST-80 compatibility'!
 
 totalSeconds
     "returns an internal second clock. Dont interpret the returned
@@ -85,41 +87,15 @@
     ^ self secondClock
 ! !
 
-!AbstractTime class methodsFor:'obsolete'!
-
-fromUnixTimeLow:low and:hi
-    "return an instance of myself, given the unix time.
-     Internal interface - not for public use."
-
-    ^ self fromOSTimeLow:low and:hi
-! !
-
-!AbstractTime class methodsFor:'private instance creation'!
+!AbstractTime  class methodsFor:'private instance creation'!
 
 fromOSTime:osTime
     "return a time, representing the time given by the operatingSystem time.
      Not meant for public use."
 
-    |low hi|
-
-    "now migrating to support LargeInteger OS-time handles ...
-     ... in the meantime, support both formats."
+    ^ self basicNew fromOSTime:osTime.
 
-    (osTime isMemberOf:Array) ifTrue:[
-	low := osTime at:1.
-	hi :=  osTime at:2.
-    ] ifFalse:[
-	low := osTime bitAnd:16rFFFF.
-	hi := (osTime bitShift:-16) bitAnd:16rFFFF.
-    ].
-    ^ self basicNew fromOSTimeLow:low and:hi
-!
-
-fromOSTimeLow:osTimeLow and:osTimeHigh
-    "return a time, representing the time given by the operatingSystem time.
-     Not meant for public use."
-
-    ^ self basicNew fromOSTimeLow:osTimeLow and:osTimeHigh
+    "Modified: 1.7.1996 / 15:09:54 / cg"
 !
 
 fromSeconds:seconds
@@ -136,12 +112,15 @@
      Time fromSeconds:0             should return midnight
      AbsoluteTime fromSeconds:0     on UNIX: returns 1st. Jan 1970
                                     on others: dont know
+     (AbsoluteTime day:1 month:1 year:1970 hour:1 minutes:0 seconds:0)
+        getSeconds                  on UNIX: returns 0
+                                    on others: dont know
     "
 
-    "Modified: 19.4.1996 / 15:22:28 / cg"
+    "Modified: 1.7.1996 / 13:39:30 / cg"
 ! !
 
-!AbstractTime class methodsFor:'queries'!
+!AbstractTime  class methodsFor:'queries'!
 
 millisecondClockValue
     "return the millisecond clock - since this one overruns
@@ -158,14 +137,16 @@
 secondClock
     "return seconds of now - for GNU-ST compatibility"
 
-    ^ OperatingSystem getTime
+    ^ OperatingSystem getOSTime // 1000
 
     "
      AbstractTime secondClock    
     "
+
+    "Modified: 1.7.1996 / 15:20:14 / cg"
 ! !
 
-!AbstractTime class methodsFor:'timing evaluations'!
+!AbstractTime  class methodsFor:'timing evaluations'!
 
 millisecondsToRun:aBlock
     "evaluate the argument, aBlock; return the number of milliseconds it took"
@@ -353,10 +334,12 @@
 
 !AbstractTime methodsFor:'private'!
 
-fromOSTime:timeParts
+fromOSTime:osTime
     "set my time, from operatingSystems time parts"
 
-    ^ self fromOSTimeLow:(timeParts at:1) and:(timeParts at:2)
+    ^ self subclassResponsibility
+
+    "Modified: 1.7.1996 / 15:09:44 / cg"
 !
 
 fromOSTimeTimeLow:lowTime and:hiTime
@@ -367,6 +350,16 @@
     ^ self subclassResponsibility
 !
 
+getMilliseconds
+    "get the milliseconds.
+     Since I am abstract (not knowing how the time is actually
+     represented), this must be done by a concrete class."
+
+    ^ self subclassResponsibility
+
+    "Created: 1.7.1996 / 14:16:49 / cg"
+!
+
 getSeconds
     "get the seconds.
      Since I am abstract (not knowing how the time is actually
@@ -375,6 +368,16 @@
     ^ self subclassResponsibility
 !
 
+setMilliseconds:millis
+    "set the milliseconds.
+     Since I am abstract (not knowing how the time is actually
+     represented), this must be done by a concrete class."
+
+    ^ self subclassResponsibility
+
+    "Created: 1.7.1996 / 14:17:00 / cg"
+!
+
 setSeconds:secs
     "set the seconds.
      Since I am abstract (not knowing how the time is actually
@@ -383,8 +386,8 @@
     ^ self subclassResponsibility
 ! !
 
-!AbstractTime class methodsFor:'documentation'!
+!AbstractTime  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/AbstractTime.st,v 1.12 1996-06-17 15:18:40 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/AbstractTime.st,v 1.13 1996-07-01 13:31:33 cg Exp $'
 ! !