69 ^ 'UTC' |
69 ^ 'UTC' |
70 ! |
70 ! |
71 |
71 |
72 utcOffset |
72 utcOffset |
73 ^ 0 |
73 ^ 0 |
|
74 ! |
|
75 |
|
76 utcOffsetWithoutDst |
|
77 ^ 0 |
74 ! ! |
78 ! ! |
75 |
79 |
76 !UtcTimestamp methodsFor:'converting'! |
80 !UtcTimestamp methodsFor:'converting'! |
77 |
|
78 asDate |
|
79 "return a Date object from the receiver. |
|
80 The returned date will only represent the day - not the timeOfDay. |
|
81 Notice: if you convert a local timestamp, you will get the local date; |
|
82 otherwise if you convert an utcTimestamp, you'll get the utc date." |
|
83 |
|
84 (osTime between:MinOSTime and:MaxOSTime) ifFalse:[ |
|
85 |dayDelta day0| |
|
86 |
|
87 dayDelta := osTime // (24 * 3600 * 1000). |
|
88 day0 := Epoch asDate. |
|
89 ^ day0 addDays:dayDelta. |
|
90 ]. |
|
91 ^ self timeInfo asDate |
|
92 |
|
93 " |
|
94 Timestamp now |
|
95 Timestamp now asDate |
|
96 (Timestamp now addTime:3600) asDate |
|
97 (Timestamp now addTime:3600) asTime |
|
98 Timestamp fromSeconds:(Timestamp now asSeconds + 3600) |
|
99 (Timestamp fromSeconds:(Timestamp now asSeconds + 3600)) asDate |
|
100 " |
|
101 ! |
|
102 |
81 |
103 asLocalTimestamp |
82 asLocalTimestamp |
104 "represent myself as a timestamp in the local timezone" |
83 "represent myself as a timestamp in the local timezone" |
105 |
84 |
106 ^ Timestamp fromOSTime:osTime |
85 ^ Timestamp fromOSTime:osTime |
107 ! |
|
108 |
|
109 asTime |
|
110 "return a Time object from the receiver. |
|
111 The returned time will only represent the timeOfDay - not the day, |
|
112 and does not include the milliseconds." |
|
113 |
|
114 |secondDelta| |
|
115 |
|
116 (osTime between:MinOSTime and:MaxOSTime) ifFalse:[ |
|
117 secondDelta := osTime // 1000. |
|
118 "/ we do not know about DST in the far future and in the long gone past. |
|
119 secondDelta := secondDelta rem:(24*3600) . |
|
120 ^ Epoch asTime addSeconds:secondDelta. |
|
121 ]. |
|
122 ^ self timeInfo asTime |
|
123 ! |
86 ! |
124 |
87 |
125 asUtcTimestamp |
88 asUtcTimestamp |
126 "I am an UtcTimestamp" |
89 "I am an UtcTimestamp" |
127 |
90 |