class: UtcTimestamp
added: #utcOffsetWithoutDst
removed:
#asDate
#asTime
--- a/UtcTimestamp.st Tue Nov 11 14:08:45 2014 +0100
+++ b/UtcTimestamp.st Tue Nov 11 14:08:59 2014 +0100
@@ -71,57 +71,20 @@
utcOffset
^ 0
+!
+
+utcOffsetWithoutDst
+ ^ 0
! !
!UtcTimestamp methodsFor:'converting'!
-asDate
- "return a Date object from the receiver.
- The returned date will only represent the day - not the timeOfDay.
- Notice: if you convert a local timestamp, you will get the local date;
- otherwise if you convert an utcTimestamp, you'll get the utc date."
-
- (osTime between:MinOSTime and:MaxOSTime) ifFalse:[
- |dayDelta day0|
-
- dayDelta := osTime // (24 * 3600 * 1000).
- day0 := Epoch asDate.
- ^ day0 addDays:dayDelta.
- ].
- ^ self timeInfo asDate
-
- "
- Timestamp now
- Timestamp now asDate
- (Timestamp now addTime:3600) asDate
- (Timestamp now addTime:3600) asTime
- Timestamp fromSeconds:(Timestamp now asSeconds + 3600)
- (Timestamp fromSeconds:(Timestamp now asSeconds + 3600)) asDate
- "
-!
-
asLocalTimestamp
"represent myself as a timestamp in the local timezone"
^ Timestamp fromOSTime:osTime
!
-asTime
- "return a Time object from the receiver.
- The returned time will only represent the timeOfDay - not the day,
- and does not include the milliseconds."
-
- |secondDelta|
-
- (osTime between:MinOSTime and:MaxOSTime) ifFalse:[
- secondDelta := osTime // 1000.
- "/ we do not know about DST in the far future and in the long gone past.
- secondDelta := secondDelta rem:(24*3600) .
- ^ Epoch asTime addSeconds:secondDelta.
- ].
- ^ self timeInfo asTime
-!
-
asUtcTimestamp
"I am an UtcTimestamp"
@@ -171,10 +134,10 @@
!UtcTimestamp class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/UtcTimestamp.st,v 1.12 2014-11-11 12:14:23 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/UtcTimestamp.st,v 1.13 2014-11-11 13:08:59 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/UtcTimestamp.st,v 1.12 2014-11-11 12:14:23 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/UtcTimestamp.st,v 1.13 2014-11-11 13:08:59 stefan Exp $'
! !