equal
deleted
inserted
replaced
155 " |
155 " |
156 |
156 |
157 "Modified: 19.4.1996 / 15:23:37 / cg" |
157 "Modified: 19.4.1996 / 15:23:37 / cg" |
158 ! |
158 ! |
159 |
159 |
|
160 epoch |
|
161 "answer the time when we start counting" |
|
162 |
|
163 ^ self new setSeconds:0 |
|
164 |
|
165 " |
|
166 Timestamp epoch |
|
167 Time epoch |
|
168 " |
|
169 ! |
|
170 |
160 now |
171 now |
161 "return an instance of myself representing this moment." |
172 "return an instance of myself representing this moment." |
162 |
173 |
163 ^ self basicNew fromOSTime:(OperatingSystem getOSTime) |
174 ^ self basicNew fromOSTime:(OperatingSystem getOSTime) |
164 |
175 |
170 "Modified: 1.7.1996 / 15:20:10 / cg" |
181 "Modified: 1.7.1996 / 15:20:10 / cg" |
171 ! ! |
182 ! ! |
172 |
183 |
173 !AbstractTime class methodsFor:'Compatibility-Squeak'! |
184 !AbstractTime class methodsFor:'Compatibility-Squeak'! |
174 |
185 |
175 dateAndTimeFromSeconds: secondCount |
186 dateAndTimeFromSeconds:secondCount |
176 "set date and time from seconds since 1901-01-01 UTC" |
187 "set date and time from seconds since 1901-01-01 00:00 UTC" |
|
188 |
177 |timestamp| |
189 |timestamp| |
178 |
190 |
179 " |
191 " |
180 secondsBetween1901and1970 := |
192 secondsBetween1901and1970 := |
181 ((Date day:1 month:1 year:1970) subtractDate:(Date day:1 month:1 year:1901)) |
193 (Timestamp epoch asDate subtractDate:(Date day:1 month:1 year:1901)) |
182 * (24 * 60 * 60) |
194 * (24 * 60 * 60) |
183 " |
195 " |
184 |
196 |
185 timestamp := Timestamp fromSeconds:secondCount-2177452800. |
197 "stc cannot make large integers" |
|
198 timestamp := Timestamp fromSeconds:secondCount - (21774528 * 100). |
186 ^ Array |
199 ^ Array |
187 with: (timestamp asDate) |
200 with: (timestamp asDate) |
188 with: (timestamp asTime) |
201 with: (timestamp asTime) |
189 |
202 |
190 " |
203 " |
464 |
477 |
465 "Created: 22.10.1996 / 09:27:47 / stefan" |
478 "Created: 22.10.1996 / 09:27:47 / stefan" |
466 ! |
479 ! |
467 |
480 |
468 timeZoneDeltaInMinutes |
481 timeZoneDeltaInMinutes |
|
482 "answer the number of minutes between local time and utc time. |
|
483 Delta is positive if local time is ahead of utc, negative if behind utc." |
|
484 |
469 ^ 0 |
485 ^ 0 |
470 ! |
486 ! |
471 |
487 |
472 timeZoneName |
488 timeZoneName |
473 ^ 'utc' |
489 ^ 'utc' |
835 aDictionary at:$a put:ampm. |
851 aDictionary at:$a put:ampm. |
836 aDictionary at:$A put:ampm asUppercase. |
852 aDictionary at:$A put:ampm asUppercase. |
837 aDictionary at:$z put:zone. |
853 aDictionary at:$z put:zone. |
838 aDictionary at:$Z put:zone asUppercase. |
854 aDictionary at:$Z put:zone asUppercase. |
839 |
855 |
840 s := tzDelta >= 0 ifTrue:[ '+' ] ifFalse:[ '-' ]. |
856 tzDelta == 0 ifTrue:[ |
841 tzDelta := tzDelta abs. |
857 s := 'Z'. |
842 s := s , ((tzDelta // 60) printStringLeftPaddedTo:2 with:$0). |
858 ] ifFalse:[ |
843 s := s , ':'. |
859 s := tzDelta < 0 ifTrue:[ '-' ] ifFalse:[ '+' ]. |
844 s := s , ((tzDelta \\ 60) printStringLeftPaddedTo:2 with:$0). |
860 tzDelta := tzDelta abs. |
|
861 s := s , ((tzDelta // 60) printStringLeftPaddedTo:2 with:$0), |
|
862 ':' , ((tzDelta \\ 60) printStringLeftPaddedTo:2 with:$0). |
|
863 ]. |
845 aDictionary at:#TZD put:s |
864 aDictionary at:#TZD put:s |
846 ! |
865 ! |
847 |
866 |
848 printOn:aStream format:aFormatString |
867 printOn:aStream format:aFormatString |
849 "print using a format string; |
868 "print using a format string; |
1047 ! ! |
1066 ! ! |
1048 |
1067 |
1049 !AbstractTime class methodsFor:'documentation'! |
1068 !AbstractTime class methodsFor:'documentation'! |
1050 |
1069 |
1051 version |
1070 version |
1052 ^ '$Header: /cvs/stx/stx/libbasic/AbstractTime.st,v 1.51 2006-07-06 15:49:51 stefan Exp $' |
1071 ^ '$Header: /cvs/stx/stx/libbasic/AbstractTime.st,v 1.52 2006-07-11 11:48:15 stefan Exp $' |
1053 ! ! |
1072 ! ! |