--- a/AbstractTime.st Thu Jul 06 18:18:59 2006 +0200
+++ b/AbstractTime.st Tue Jul 11 13:48:15 2006 +0200
@@ -157,6 +157,17 @@
"Modified: 19.4.1996 / 15:23:37 / cg"
!
+epoch
+ "answer the time when we start counting"
+
+ ^ self new setSeconds:0
+
+ "
+ Timestamp epoch
+ Time epoch
+ "
+!
+
now
"return an instance of myself representing this moment."
@@ -172,17 +183,19 @@
!AbstractTime class methodsFor:'Compatibility-Squeak'!
-dateAndTimeFromSeconds: secondCount
- "set date and time from seconds since 1901-01-01 UTC"
+dateAndTimeFromSeconds:secondCount
+ "set date and time from seconds since 1901-01-01 00:00 UTC"
+
|timestamp|
"
secondsBetween1901and1970 :=
- ((Date day:1 month:1 year:1970) subtractDate:(Date day:1 month:1 year:1901))
+ (Timestamp epoch asDate subtractDate:(Date day:1 month:1 year:1901))
* (24 * 60 * 60)
"
- timestamp := Timestamp fromSeconds:secondCount-2177452800.
+ "stc cannot make large integers"
+ timestamp := Timestamp fromSeconds:secondCount - (21774528 * 100).
^ Array
with: (timestamp asDate)
with: (timestamp asTime)
@@ -466,6 +479,9 @@
!
timeZoneDeltaInMinutes
+ "answer the number of minutes between local time and utc time.
+ Delta is positive if local time is ahead of utc, negative if behind utc."
+
^ 0
!
@@ -837,11 +853,14 @@
aDictionary at:$z put:zone.
aDictionary at:$Z put:zone asUppercase.
- s := tzDelta >= 0 ifTrue:[ '+' ] ifFalse:[ '-' ].
- tzDelta := tzDelta abs.
- s := s , ((tzDelta // 60) printStringLeftPaddedTo:2 with:$0).
- s := s , ':'.
- s := s , ((tzDelta \\ 60) printStringLeftPaddedTo:2 with:$0).
+ tzDelta == 0 ifTrue:[
+ s := 'Z'.
+ ] ifFalse:[
+ s := tzDelta < 0 ifTrue:[ '-' ] ifFalse:[ '+' ].
+ tzDelta := tzDelta abs.
+ s := s , ((tzDelta // 60) printStringLeftPaddedTo:2 with:$0),
+ ':' , ((tzDelta \\ 60) printStringLeftPaddedTo:2 with:$0).
+ ].
aDictionary at:#TZD put:s
!
@@ -1049,5 +1068,5 @@
!AbstractTime class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/AbstractTime.st,v 1.51 2006-07-06 15:49:51 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/AbstractTime.st,v 1.52 2006-07-11 11:48:15 stefan Exp $'
! !