author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 16 Jun 2010 21:12:05 +0100 | |
branch | jv |
changeset 17767 | a4a32df3aa5e |
parent 17761 | b0e5971141bc |
child 17772 | 6e0b3c06c364 |
permissions | -rw-r--r-- |
240 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
7010 | 3 |
All Rights Reserved |
240 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
5548 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
240 | 14 |
Magnitude subclass:#AbstractTime |
7258 | 15 |
instanceVariableNames:'' |
16 |
classVariableNames:'' |
|
17 |
poolDictionaries:'' |
|
7672 | 18 |
category:'Magnitude-Time' |
240 | 19 |
! |
20 |
||
2310
2cb1366e0eb3
Correct name: #secondDay --> #secondInDay.
Stefan Vogel <sv@exept.de>
parents:
1500
diff
changeset
|
21 |
!AbstractTime class methodsFor:'documentation'! |
240 | 22 |
|
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
7010 | 26 |
All Rights Reserved |
240 | 27 |
|
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
37 |
documentation |
|
38 |
" |
|
1500
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
39 |
This is an abstract class providing common protocol for Time (time in day) |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
40 |
and Timestamp (time plus day). |
1500
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
41 |
There are no instances of this class in the system. |
275 | 42 |
It is meant as a home for methods common to time handling classes. |
1282 | 43 |
|
1295 | 44 |
[author:] |
45 |
Claus Gittinger |
|
46 |
||
1282 | 47 |
[See also:] |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
48 |
Time Date Timestamp |
1282 | 49 |
Delay ProcessorScheduler |
240 | 50 |
" |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
51 |
! |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
52 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
53 |
iso8601Format |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
54 |
" |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
55 |
Abstract |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
56 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
57 |
This document defines a profile of ISO 8601, the International Standard for the representation of dates and times. ISO |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
58 |
8601 describes a large number of date/time formats. To reduce the scope for error and the complexity of software, it is |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
59 |
useful to restrict the supported formats to a small number. This profile defines a few date/time formats, likely to satisfy |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
60 |
most requirements. |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
61 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
62 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
63 |
Formats |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
64 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
65 |
Different standards may need different levels of granularity in the date and time, so this profile defines six levels. |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
66 |
Standards that reference this profile should specify one or more of these granularities. If a given standard allows more |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
67 |
than one granularity, it should specify the meaning of the dates and times with reduced precision, for example, the result |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
68 |
of comparing two dates with different precisions. |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
69 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
70 |
The formats are as follows. Exactly the components shown here must be present, with exactly this punctuation. Note |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
71 |
that the 'T' appears literally in the string, to indicate the beginning of the time element, as specified in ISO 8601. |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
72 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
73 |
Year: |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
74 |
YYYY (eg 1997) |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
75 |
Year and month: |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
76 |
YYYY-MM (eg 1997-07) |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
77 |
Complete date: |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
78 |
YYYY-MM-DD (eg 1997-07-16) |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
79 |
Complete date plus hours and minutes: |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
80 |
YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00) |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
81 |
Complete date plus hours, minutes and seconds: |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
82 |
YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00) |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
83 |
Complete date plus hours, minutes, seconds and a decimal fraction of a |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
84 |
second |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
85 |
YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00) |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
86 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
87 |
where: |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
88 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
89 |
YYYY = four-digit year |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
90 |
MM = two-digit month (01=January, etc.) |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
91 |
DD = two-digit day of month (01 through 31) |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
92 |
hh = two digits of hour (00 through 23) (am/pm NOT allowed) |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
93 |
mm = two digits of minute (00 through 59) |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
94 |
ss = two digits of second (00 through 59) |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
95 |
s = one or more digits representing a decimal fraction of a second |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
96 |
TZD = time zone designator (Z or +hh:mm or -hh:mm) |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
97 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
98 |
This profile does not specify how many digits may be used to represent the decimal fraction of a second. An adopting |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
99 |
standard that permits fractions of a second must specify both the minimum number of digits (a number greater than or |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
100 |
equal to one) and the maximum number of digits (the maximum may be stated to be 'unlimited'). |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
101 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
102 |
This profile defines two ways of handling time zone offsets: |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
103 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
104 |
1.Times are expressed in UTC (Coordinated Universal Time), with a special UTC designator ('Z'). |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
105 |
2.Times are expressed in local time, together with a time zone offset in hours and minutes. A time zone offset of |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
106 |
'+hh:mm' indicates that the date/time uses a local time zone which is 'hh' hours and 'mm' minutes ahead of |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
107 |
UTC. A time zone offset of '-hh:mm' indicates that the date/time uses a local time zone which is 'hh' hours and |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
108 |
'mm' minutes behind UTC. |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
109 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
110 |
A standard referencing this profile should permit one or both of these ways of handling time zone offsets. |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
111 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
112 |
The ISO8601 printString are generated with: |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
113 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
114 |
Year: |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
115 |
YYYY (eg 1997) |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
116 |
Date today printStringFormat:'%(year)' |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
117 |
Timestamp now printStringFormat:'%(year)' |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
118 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
119 |
Year and month: |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
120 |
YYYY-MM (eg 1997-07) |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
121 |
Date today printStringFormat:'%(year)-%(month)' |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
122 |
Timestamp now printStringFormat:'%(year)-%(month)' |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
123 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
124 |
Complete date: |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
125 |
YYYY-MM-DD (eg 1997-07-16) |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
126 |
Date today printStringFormat:'%(year)-%(month)-%(day)' |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
127 |
Timestamp now printStringFormat:'%(year)-%(month)-%(day)' |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
128 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
129 |
Complete date plus hours and minutes: |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
130 |
YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00) |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
131 |
Timestamp now printStringFormat:'%(year)-%(month)-%(day)T%h:%m%(TZD)' |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
132 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
133 |
Complete date plus hours, minutes and seconds: |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
134 |
YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00) |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
135 |
Timestamp now printStringFormat:'%(year)-%(month)-%(day)T%h:%m:%s%(TZD)' |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
136 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
137 |
Complete date plus hours, minutes, seconds and a decimal fraction of a second |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
138 |
YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00) |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
139 |
Timestamp now printStringFormat:'%(year)-%(month)-%(day)T%h:%m:%s.%(milli2)%(TZD)' |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
140 |
" |
240 | 141 |
! ! |
142 |
||
2310
2cb1366e0eb3
Correct name: #secondDay --> #secondInDay.
Stefan Vogel <sv@exept.de>
parents:
1500
diff
changeset
|
143 |
!AbstractTime class methodsFor:'instance creation'! |
240 | 144 |
|
699 | 145 |
dateAndTimeNow |
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
146 |
"return an array filled with the current date and time. |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
147 |
See also: Date today / Time now / Timestamp now." |
240 | 148 |
|
699 | 149 |
^ Array with:(Date today) with:(Time now) |
240 | 150 |
|
151 |
" |
|
699 | 152 |
Time dateAndTimeNow |
7007
9af8cc2f82a4
totalSeconds returns the number of seconds since 1.1.1901 now
penk
parents:
6888
diff
changeset
|
153 |
Date dateAndTimeNow |
240 | 154 |
" |
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
155 |
|
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
156 |
"Modified: 19.4.1996 / 15:23:37 / cg" |
275 | 157 |
! |
240 | 158 |
|
9432 | 159 |
epoch |
160 |
"answer the time when we start counting" |
|
161 |
||
162 |
^ self new setSeconds:0 |
|
163 |
||
164 |
" |
|
165 |
Timestamp epoch |
|
166 |
Time epoch |
|
167 |
" |
|
168 |
! |
|
169 |
||
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
170 |
now |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
171 |
"return an instance of myself representing this moment." |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
172 |
|
1500
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
173 |
^ self basicNew fromOSTime:(OperatingSystem getOSTime) |
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
174 |
|
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
175 |
" |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
176 |
Timestamp now |
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
177 |
Time now |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
178 |
" |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
179 |
|
1500
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
180 |
"Modified: 1.7.1996 / 15:20:10 / cg" |
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
181 |
! ! |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
182 |
|
7294 | 183 |
!AbstractTime class methodsFor:'Compatibility-Squeak'! |
7007
9af8cc2f82a4
totalSeconds returns the number of seconds since 1.1.1901 now
penk
parents:
6888
diff
changeset
|
184 |
|
9432 | 185 |
dateAndTimeFromSeconds:secondCount |
186 |
"set date and time from seconds since 1901-01-01 00:00 UTC" |
|
187 |
||
9429
173bcd493d7c
Fix for utc botch when retrieving seconds since 1901
Stefan Vogel <sv@exept.de>
parents:
8586
diff
changeset
|
188 |
|timestamp| |
173bcd493d7c
Fix for utc botch when retrieving seconds since 1901
Stefan Vogel <sv@exept.de>
parents:
8586
diff
changeset
|
189 |
|
173bcd493d7c
Fix for utc botch when retrieving seconds since 1901
Stefan Vogel <sv@exept.de>
parents:
8586
diff
changeset
|
190 |
" |
173bcd493d7c
Fix for utc botch when retrieving seconds since 1901
Stefan Vogel <sv@exept.de>
parents:
8586
diff
changeset
|
191 |
secondsBetween1901and1970 := |
9432 | 192 |
(Timestamp epoch asDate subtractDate:(Date day:1 month:1 year:1901)) |
9429
173bcd493d7c
Fix for utc botch when retrieving seconds since 1901
Stefan Vogel <sv@exept.de>
parents:
8586
diff
changeset
|
193 |
* (24 * 60 * 60) |
173bcd493d7c
Fix for utc botch when retrieving seconds since 1901
Stefan Vogel <sv@exept.de>
parents:
8586
diff
changeset
|
194 |
" |
173bcd493d7c
Fix for utc botch when retrieving seconds since 1901
Stefan Vogel <sv@exept.de>
parents:
8586
diff
changeset
|
195 |
|
9432 | 196 |
"stc cannot make large integers" |
9449
6ba774be6aa1
stc can compile large integers!
Stefan Vogel <sv@exept.de>
parents:
9432
diff
changeset
|
197 |
timestamp := Timestamp fromSeconds:secondCount - 2177452800. |
7007
9af8cc2f82a4
totalSeconds returns the number of seconds since 1.1.1901 now
penk
parents:
6888
diff
changeset
|
198 |
^ Array |
9429
173bcd493d7c
Fix for utc botch when retrieving seconds since 1901
Stefan Vogel <sv@exept.de>
parents:
8586
diff
changeset
|
199 |
with: (timestamp asDate) |
173bcd493d7c
Fix for utc botch when retrieving seconds since 1901
Stefan Vogel <sv@exept.de>
parents:
8586
diff
changeset
|
200 |
with: (timestamp asTime) |
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
201 |
|
7007
9af8cc2f82a4
totalSeconds returns the number of seconds since 1.1.1901 now
penk
parents:
6888
diff
changeset
|
202 |
" |
9429
173bcd493d7c
Fix for utc botch when retrieving seconds since 1901
Stefan Vogel <sv@exept.de>
parents:
8586
diff
changeset
|
203 |
Timestamp dateAndTimeFromSeconds: (Time primSecondsClock) |
7007
9af8cc2f82a4
totalSeconds returns the number of seconds since 1.1.1901 now
penk
parents:
6888
diff
changeset
|
204 |
Time dateAndTimeFromSeconds: (Time totalSeconds) |
9af8cc2f82a4
totalSeconds returns the number of seconds since 1.1.1901 now
penk
parents:
6888
diff
changeset
|
205 |
Date dateAndTimeFromSeconds: (Time totalSeconds) |
9af8cc2f82a4
totalSeconds returns the number of seconds since 1.1.1901 now
penk
parents:
6888
diff
changeset
|
206 |
" |
9af8cc2f82a4
totalSeconds returns the number of seconds since 1.1.1901 now
penk
parents:
6888
diff
changeset
|
207 |
! |
9af8cc2f82a4
totalSeconds returns the number of seconds since 1.1.1901 now
penk
parents:
6888
diff
changeset
|
208 |
|
11528 | 209 |
milliseconds:msTime1 since:msTime2 |
210 |
"return the number of milliseconds between two |
|
211 |
millisecond time values, compensating for roll-over. |
|
212 |
The same as millisecondsBetween:and: for Squeak compatibility." |
|
213 |
||
214 |
^ OperatingSystem millisecondTimeDeltaBetween:msTime1 and:msTime2 |
|
215 |
! |
|
216 |
||
9926 | 217 |
millisecondsSince: lastTime |
218 |
"Answer the elapsed time since last recorded in milliseconds. |
|
219 |
Compensate for rollover." |
|
220 |
||
221 |
^self milliseconds: self millisecondClockValue since: lastTime |
|
222 |
! |
|
223 |
||
7007
9af8cc2f82a4
totalSeconds returns the number of seconds since 1.1.1901 now
penk
parents:
6888
diff
changeset
|
224 |
primSecondsClock |
9429
173bcd493d7c
Fix for utc botch when retrieving seconds since 1901
Stefan Vogel <sv@exept.de>
parents:
8586
diff
changeset
|
225 |
"returns the number of seconds since 1.1.1901 UTC" |
173bcd493d7c
Fix for utc botch when retrieving seconds since 1901
Stefan Vogel <sv@exept.de>
parents:
8586
diff
changeset
|
226 |
|
173bcd493d7c
Fix for utc botch when retrieving seconds since 1901
Stefan Vogel <sv@exept.de>
parents:
8586
diff
changeset
|
227 |
^ Timestamp now utcSecondsSince1901 |
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
228 |
|
9429
173bcd493d7c
Fix for utc botch when retrieving seconds since 1901
Stefan Vogel <sv@exept.de>
parents:
8586
diff
changeset
|
229 |
" |
173bcd493d7c
Fix for utc botch when retrieving seconds since 1901
Stefan Vogel <sv@exept.de>
parents:
8586
diff
changeset
|
230 |
Timestamp primSecondsClock |
173bcd493d7c
Fix for utc botch when retrieving seconds since 1901
Stefan Vogel <sv@exept.de>
parents:
8586
diff
changeset
|
231 |
" |
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
232 |
! ! |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
233 |
|
7294 | 234 |
!AbstractTime class methodsFor:'Compatibility-VW'! |
7007
9af8cc2f82a4
totalSeconds returns the number of seconds since 1.1.1901 now
penk
parents:
6888
diff
changeset
|
235 |
|
9af8cc2f82a4
totalSeconds returns the number of seconds since 1.1.1901 now
penk
parents:
6888
diff
changeset
|
236 |
totalSeconds |
9429
173bcd493d7c
Fix for utc botch when retrieving seconds since 1901
Stefan Vogel <sv@exept.de>
parents:
8586
diff
changeset
|
237 |
"returns the number of seconds since 1.1.1901 UTC" |
7007
9af8cc2f82a4
totalSeconds returns the number of seconds since 1.1.1901 now
penk
parents:
6888
diff
changeset
|
238 |
|
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
239 |
^ Timestamp now utcSecondsSince1901 |
7007
9af8cc2f82a4
totalSeconds returns the number of seconds since 1.1.1901 now
penk
parents:
6888
diff
changeset
|
240 |
! ! |
9af8cc2f82a4
totalSeconds returns the number of seconds since 1.1.1901 now
penk
parents:
6888
diff
changeset
|
241 |
|
11130 | 242 |
!AbstractTime class methodsFor:'error handling'! |
243 |
||
244 |
conversionErrorSignal |
|
245 |
"return the signal used for conversion error handling" |
|
246 |
||
247 |
^ TimeConversionError |
|
248 |
! ! |
|
249 |
||
7258 | 250 |
!AbstractTime class methodsFor:'private-instance creation'! |
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
251 |
|
275 | 252 |
fromOSTime:osTime |
253 |
"return a time, representing the time given by the operatingSystem time. |
|
254 |
Not meant for public use." |
|
255 |
||
1500
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
256 |
^ self basicNew fromOSTime:osTime. |
418 | 257 |
|
1500
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
258 |
"Modified: 1.7.1996 / 15:09:54 / cg" |
240 | 259 |
! |
260 |
||
699 | 261 |
fromSeconds:seconds |
262 |
"return an instance that is constructed from seconds. |
|
263 |
This method is only allowed for second values as returned by |
|
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
264 |
getSeconds, possibly adding/subtracting to that. |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
265 |
Never depend on any specific interpretation of the seconds, |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
266 |
since it depends on how the OperatingSystem counts time |
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
267 |
(some start at 1900, others with 1970 ...)" |
240 | 268 |
|
699 | 269 |
^ self basicNew setSeconds:seconds |
240 | 270 |
|
271 |
" |
|
699 | 272 |
Time fromSeconds:0 should return midnight |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
273 |
Timestamp fromSeconds:0 on UNIX: returns 1st. Jan 1970 |
1227
e89b39909085
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
699
diff
changeset
|
274 |
on others: dont know |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
275 |
(Timestamp day:1 month:1 year:1970 hour:1 minutes:0 seconds:0) |
1500
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
276 |
getSeconds on UNIX: returns 0 |
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
277 |
on others: dont know |
699 | 278 |
" |
279 |
||
1500
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
280 |
"Modified: 1.7.1996 / 13:39:30 / cg" |
240 | 281 |
! ! |
282 |
||
2310
2cb1366e0eb3
Correct name: #secondDay --> #secondInDay.
Stefan Vogel <sv@exept.de>
parents:
1500
diff
changeset
|
283 |
!AbstractTime class methodsFor:'queries'! |
275 | 284 |
|
699 | 285 |
millisecondClockValue |
286 |
"return the millisecond clock - since this one overruns |
|
287 |
regularly, use the value only for short timing deltas. |
|
5730 | 288 |
Also remember that it wraps when comparing these values." |
275 | 289 |
|
699 | 290 |
^ OperatingSystem getMillisecondTime. |
291 |
||
292 |
" |
|
293 |
Time millisecondClockValue |
|
294 |
" |
|
275 | 295 |
! |
296 |
||
699 | 297 |
secondClock |
298 |
"return seconds of now - for GNU-ST compatibility" |
|
299 |
||
1500
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
300 |
^ OperatingSystem getOSTime // 1000 |
699 | 301 |
|
302 |
" |
|
303 |
AbstractTime secondClock |
|
304 |
" |
|
1500
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
305 |
|
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
306 |
"Modified: 1.7.1996 / 15:20:14 / cg" |
699 | 307 |
! ! |
308 |
||
2310
2cb1366e0eb3
Correct name: #secondDay --> #secondInDay.
Stefan Vogel <sv@exept.de>
parents:
1500
diff
changeset
|
309 |
!AbstractTime class methodsFor:'timing evaluations'! |
275 | 310 |
|
17757 | 311 |
microsecondsToRun:aBlock |
312 |
"evaluate the argument, aBlock; return the number of milliseconds it took" |
|
313 |
||
314 |
|startTime endTime| |
|
315 |
||
316 |
startTime := OperatingSystem getMicrosecondTime. |
|
317 |
aBlock value. |
|
318 |
endTime := OperatingSystem getMicrosecondTime. |
|
319 |
^ endTime - startTime |
|
320 |
||
321 |
" |
|
322 |
Time microsecondsToRun:[1000 factorial] |
|
323 |
" |
|
324 |
! |
|
325 |
||
699 | 326 |
millisecondsToRun:aBlock |
327 |
"evaluate the argument, aBlock; return the number of milliseconds it took" |
|
328 |
||
329 |
|startTime endTime| |
|
330 |
||
1476 | 331 |
startTime := OperatingSystem getMillisecondTime. |
699 | 332 |
aBlock value. |
1476 | 333 |
endTime := OperatingSystem getMillisecondTime. |
8586
a38e882affa5
take care of time-wrap in #millisecondsToRun:
Stefan Vogel <sv@exept.de>
parents:
8450
diff
changeset
|
334 |
^ self milliseconds:endTime since:startTime |
699 | 335 |
|
336 |
" |
|
8586
a38e882affa5
take care of time-wrap in #millisecondsToRun:
Stefan Vogel <sv@exept.de>
parents:
8450
diff
changeset
|
337 |
Time millisecondsToRun:[1000 factorial] |
699 | 338 |
" |
1476 | 339 |
|
340 |
"Modified: 17.6.1996 / 16:57:37 / cg" |
|
275 | 341 |
! |
342 |
||
699 | 343 |
secondsToRun:aBlock |
344 |
"evaluate the argument, aBlock; return the number of seconds it took" |
|
345 |
||
346 |
|startTime endTime| |
|
360 | 347 |
|
699 | 348 |
startTime := self secondClock. |
349 |
aBlock value. |
|
350 |
endTime := self secondClock. |
|
351 |
^ endTime - startTime |
|
275 | 352 |
|
699 | 353 |
" |
354 |
Time secondsToRun:[1000 factorial] |
|
355 |
" |
|
275 | 356 |
! ! |
357 |
||
7261 | 358 |
!AbstractTime methodsFor:'Compatibility-ANSI'! |
6419 | 359 |
|
360 |
hour12 |
|
361 |
"return the hour (1..12)." |
|
362 |
||
363 |
^ self hours - 1 \\ 12 + 1. |
|
364 |
||
365 |
" |
|
366 |
Time now hour12 |
|
367 |
Time now hour24 |
|
368 |
(Time hours:0 minutes:0 seconds:0) hour24 |
|
369 |
(Time hours:0 minutes:0 seconds:0) hour12 |
|
370 |
(Time hours:1 minutes:0 seconds:0) hour24 |
|
371 |
(Time hours:1 minutes:0 seconds:0) hour12 |
|
372 |
(Time hours:12 minutes:0 seconds:0) hour24 |
|
373 |
(Time hours:12 minutes:0 seconds:0) hour12 |
|
374 |
(Time hours:13 minutes:0 seconds:0) hour24 |
|
375 |
(Time hours:13 minutes:0 seconds:0) hour12 |
|
376 |
(Time hours:23 minutes:0 seconds:0) hour24 |
|
377 |
(Time hours:23 minutes:0 seconds:0) hour12 |
|
378 |
(Time hours:24 minutes:0 seconds:0) hour24 |
|
379 |
(Time hours:24 minutes:0 seconds:0) hour12 |
|
380 |
" |
|
381 |
! |
|
382 |
||
383 |
hour24 |
|
384 |
"return the hour (0..23)." |
|
385 |
||
386 |
^ self hours |
|
387 |
||
388 |
" |
|
389 |
Time now hour12 |
|
390 |
Time now hour24 |
|
391 |
(Time hours:0 minutes:0 seconds:0) hour24 |
|
392 |
(Time hours:0 minutes:0 seconds:0) hour12 |
|
393 |
(Time hours:1 minutes:0 seconds:0) hour24 |
|
394 |
(Time hours:1 minutes:0 seconds:0) hour12 |
|
395 |
(Time hours:12 minutes:0 seconds:0) hour24 |
|
396 |
(Time hours:12 minutes:0 seconds:0) hour12 |
|
397 |
(Time hours:13 minutes:0 seconds:0) hour24 |
|
398 |
(Time hours:13 minutes:0 seconds:0) hour12 |
|
399 |
(Time hours:23 minutes:0 seconds:0) hour24 |
|
400 |
(Time hours:23 minutes:0 seconds:0) hour12 |
|
401 |
(Time hours:24 minutes:0 seconds:0) hour24 |
|
402 |
(Time hours:24 minutes:0 seconds:0) hour12 |
|
403 |
" |
|
404 |
! |
|
405 |
||
406 |
meridianAbbreviation |
|
407 |
"am/pm" |
|
408 |
||
409 |
self hours // 12 == 0 ifTrue:[ |
|
410 |
^ 'am'. |
|
411 |
] ifFalse:[ |
|
8200 | 412 |
(self hours == 12 and:[self minutes == 0 and:[self seconds == 0]]) ifTrue:[ |
413 |
^ 'noon' |
|
414 |
]. |
|
6419 | 415 |
^ 'pm'. |
416 |
]. |
|
417 |
||
418 |
" |
|
419 |
Time now meridianAbbreviation |
|
420 |
(Time hours:0 minutes:0 seconds:0) meridianAbbreviation |
|
421 |
(Time hours:11 minutes:59 seconds:59) meridianAbbreviation |
|
422 |
(Time hours:12 minutes:0 seconds:0) meridianAbbreviation |
|
423 |
(Time hours:12 minutes:0 seconds:1) meridianAbbreviation |
|
424 |
" |
|
425 |
! ! |
|
426 |
||
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
427 |
!AbstractTime methodsFor:'abstract'! |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
428 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
429 |
hours |
8200 | 430 |
"return the hour of time (0..23)" |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
431 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
432 |
^ self subclassResponsibility |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
433 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
434 |
" |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
435 |
Timestamp now hours |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
436 |
Time now hours |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
437 |
" |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
438 |
! |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
439 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
440 |
milliseconds |
8200 | 441 |
"return the milliseconds since the start of the second (0..999)" |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
442 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
443 |
^ self subclassResponsibility |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
444 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
445 |
" |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
446 |
Timestamp now milliseconds |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
447 |
Time now milliseconds |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
448 |
" |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
449 |
! |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
450 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
451 |
minutes |
8200 | 452 |
"return the minutes since the start of the hour (0..59)" |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
453 |
|
7672 | 454 |
^ self subclassResponsibility. |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
455 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
456 |
" |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
457 |
Timestamp now minutes |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
458 |
Time now minutes |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
459 |
" |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
460 |
! |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
461 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
462 |
seconds |
8200 | 463 |
"return the seconds since the start of the minute (0..59)" |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
464 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
465 |
^ self subclassResponsibility |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
466 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
467 |
" |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
468 |
Timestamp now seconds. |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
469 |
Time now seconds |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
470 |
" |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
471 |
! ! |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
472 |
|
275 | 473 |
!AbstractTime methodsFor:'accessing'! |
474 |
||
475 |
hourInDay |
|
476 |
"return the hours (0..23)" |
|
477 |
||
478 |
^ self hours |
|
479 |
||
480 |
" |
|
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
481 |
Timestamp now hourInDay |
275 | 482 |
Time now hourInDay |
483 |
" |
|
484 |
! |
|
485 |
||
486 |
minuteInDay |
|
487 |
"return the minutes (0..59)" |
|
488 |
||
489 |
^ self minutes. |
|
490 |
||
491 |
" |
|
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
492 |
Timestamp now minuteInDay |
275 | 493 |
Time now minuteInDay |
494 |
" |
|
495 |
! |
|
496 |
||
2310
2cb1366e0eb3
Correct name: #secondDay --> #secondInDay.
Stefan Vogel <sv@exept.de>
parents:
1500
diff
changeset
|
497 |
secondInDay |
275 | 498 |
"return the seconds (0..59)" |
499 |
||
500 |
^ self seconds |
|
501 |
||
502 |
" |
|
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
503 |
Timestamp now secondInDay |
275 | 504 |
Time now seconds |
505 |
" |
|
2310
2cb1366e0eb3
Correct name: #secondDay --> #secondInDay.
Stefan Vogel <sv@exept.de>
parents:
1500
diff
changeset
|
506 |
|
2cb1366e0eb3
Correct name: #secondDay --> #secondInDay.
Stefan Vogel <sv@exept.de>
parents:
1500
diff
changeset
|
507 |
"Created: 22.10.1996 / 09:27:47 / stefan" |
5548 | 508 |
! |
509 |
||
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
510 |
timeZoneDeltaInMinutes |
9432 | 511 |
"answer the number of minutes between local time and utc time. |
512 |
Delta is positive if local time is ahead of utc, negative if behind utc." |
|
513 |
||
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
514 |
^ 0 |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
515 |
! |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
516 |
|
5968 | 517 |
timeZoneName |
10485 | 518 |
^ #utc |
5968 | 519 |
! |
520 |
||
5548 | 521 |
weekInYear |
522 |
"return the week number of the receiver - 1 for Jan, 1st." |
|
523 |
||
524 |
^ Date weekInYearOf:self |
|
525 |
||
526 |
" |
|
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
527 |
(Timestamp newDay:1 year:2000) weekInYear |
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
528 |
(Timestamp newDay:2 year:2000) weekInYear |
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
529 |
(Timestamp newDay:3 year:2000) weekInYear |
5548 | 530 |
" |
275 | 531 |
! ! |
532 |
||
533 |
!AbstractTime methodsFor:'arithmetic'! |
|
534 |
||
10679 | 535 |
+ aNumberOrTimeDuration |
536 |
"Add aNumber numberOfSeconds or, if its a timeDuration, add its value" |
|
8200 | 537 |
|
10679 | 538 |
^ aNumberOrTimeDuration sumFromTimestamp:self. |
539 |
||
540 |
"/ ^ self species basicNew |
|
541 |
"/ setMilliseconds:(self getMilliseconds + (aNumberOrTimeDuration * 1000) asInteger) |
|
8200 | 542 |
|
543 |
" |
|
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
544 |
Timestamp now to:(Timestamp now + 30) by:2 do:[:time| |
8200 | 545 |
Transcript showCR:time. |
546 |
]. |
|
547 |
||
10679 | 548 |
(Timestamp now + 20) - Timestamp now |
549 |
(Timestamp now + 0.5) - Timestamp now |
|
550 |
(Timestamp now + (TimeDuration fromString:'1m 10s')) - Timestamp now |
|
17728
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
551 |
(Timestamp now + (10 seconds)) - Timestamp now |
8200 | 552 |
" |
553 |
! |
|
554 |
||
555 |
- aTimeOrNumberOfSeconds |
|
8244 | 556 |
"return the delta in seconds between 2 times or subtract a number of seconds." |
275 | 557 |
|
11515 | 558 |
"/ aTimeOrNumberOfSeconds isNumber ifTrue:[ |
559 |
"/ ^ self species basicNew |
|
560 |
"/ setMilliseconds:(self getMilliseconds - (aTimeOrNumberOfSeconds * 1000) asInteger) |
|
561 |
"/ ]. |
|
562 |
"/ ^ self getSeconds - aTimeOrNumberOfSeconds getSeconds |
|
563 |
^ aTimeOrNumberOfSeconds differenceFromTimestamp:self. |
|
275 | 564 |
|
565 |
" |
|
11518 | 566 |
Timestamp now - 3600. |
11515 | 567 |
Time now - 3600. |
11518 | 568 |
(Time now addSeconds:10) - Time now |
11515 | 569 |
(TimeDuration fromString:'1.5hr') - 3600. |
570 |
(TimeDuration fromString:'1.5hr') - (TimeDuration fromString:'1hr') |
|
8200 | 571 |
|
275 | 572 |
|t1 t2| |
573 |
||
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
574 |
t1 := Timestamp now. |
275 | 575 |
(Delay forSeconds:5) wait. |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
576 |
t2 := Timestamp now. |
3476
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
577 |
Transcript showCR:('seconds passed: ' , (t2 - t1) printString). |
275 | 578 |
" |
579 |
! |
|
580 |
||
6048
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
581 |
addDays:numberOfDays |
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
582 |
"return a new instance of myself, numberOfDays afterwards." |
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
583 |
|
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
584 |
^ self addSeconds:(numberOfDays * (60 * 60 * 24)) |
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
585 |
|
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
586 |
" |
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
587 |
|t| |
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
588 |
|
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
589 |
t := Timestamp now. |
6048
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
590 |
Transcript showCR:t. |
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
591 |
Transcript showCR:(t addDays:7) |
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
592 |
" |
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
593 |
! |
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
594 |
|
699 | 595 |
addHours:numberOfHours |
596 |
"return a new instance of myself, numberOfHours afterwards." |
|
275 | 597 |
|
699 | 598 |
^ self addSeconds:(numberOfHours * (60 * 60)) |
275 | 599 |
|
600 |
" |
|
601 |
|t| |
|
602 |
||
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
603 |
t := Timestamp now. |
3476
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
604 |
Transcript showCR:t. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
605 |
Transcript showCR:(t addHours:12). |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
606 |
" |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
607 |
|
275 | 608 |
" |
3476
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
609 |
|t| |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
610 |
|
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
611 |
t := Time now. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
612 |
Transcript showCR:t. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
613 |
Transcript showCR:(t addHours:12). |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
614 |
" |
6043
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
615 |
! |
3476
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
616 |
|
6043
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
617 |
addMilliseconds:numberOfMilliSeconds |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
618 |
"return a new instance of myself, numberOfMilliSeconds afterwards." |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
619 |
|
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
620 |
^ self species basicNew |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
621 |
setMilliseconds:(self getMilliseconds + numberOfMilliSeconds) |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
622 |
|
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
623 |
" |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
624 |
|t| |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
625 |
|
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
626 |
t := Timestamp now. |
6043
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
627 |
Transcript showCR:t. |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
628 |
Transcript showCR:(t addMilliseconds:100). |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
629 |
" |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
630 |
|
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
631 |
" |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
632 |
|t| |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
633 |
|
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
634 |
t := Time now. |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
635 |
Transcript showCR:t. |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
636 |
Transcript showCR:(t addMilliseconds:1000). |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
637 |
" |
275 | 638 |
! |
639 |
||
640 |
addMinutes:numberOfMinutes |
|
641 |
"return a new instance of myself, numberOfMinutes afterwards." |
|
642 |
||
643 |
^ self addSeconds:(numberOfMinutes * 60) |
|
644 |
||
645 |
" |
|
646 |
|t| |
|
647 |
||
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
648 |
t := Timestamp now. |
3476
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
649 |
Transcript showCR:t. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
650 |
Transcript showCR:(t addMinutes:60). |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
651 |
" |
275 | 652 |
|
3476
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
653 |
" |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
654 |
|t| |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
655 |
|
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
656 |
t := Time now. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
657 |
Transcript showCR:t. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
658 |
Transcript showCR:(t addMinutes:60). |
275 | 659 |
" |
660 |
! |
|
661 |
||
699 | 662 |
addSeconds:numberOfSeconds |
663 |
"return a new instance of myself, numberOfSeconds afterwards." |
|
664 |
||
3476
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
665 |
^ self species basicNew |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
666 |
setMilliseconds:(self getMilliseconds + (numberOfSeconds * 1000)) |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
667 |
|
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
668 |
" |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
669 |
|t| |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
670 |
|
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
671 |
t := Timestamp now. |
3476
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
672 |
Transcript showCR:t. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
673 |
Transcript showCR:(t addSeconds:60). |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
674 |
" |
699 | 675 |
|
676 |
" |
|
677 |
|t| |
|
678 |
||
3476
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
679 |
t := Time now. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
680 |
Transcript showCR:t. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
681 |
Transcript showCR:(t addSeconds:60). |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
682 |
" |
699 | 683 |
! |
684 |
||
685 |
addTime:timeAmount |
|
686 |
"return a new instance of myself, timeAmount seconds afterwards. |
|
3476
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
687 |
Provided for ST-80 compatibility. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
688 |
WARNING: |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
689 |
AddTime is a bad name - it does not add a time, but expects |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
690 |
a numberOfSeconds as argument. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
691 |
Use any of addSeconds/addHours etc. to make things clear" |
699 | 692 |
|
6888
d75cbe2e8ef7
addTime / subtractTime handle non-Number argument
Claus Gittinger <cg@exept.de>
parents:
6795
diff
changeset
|
693 |
timeAmount isNumber ifFalse:[ |
d75cbe2e8ef7
addTime / subtractTime handle non-Number argument
Claus Gittinger <cg@exept.de>
parents:
6795
diff
changeset
|
694 |
^ self addSeconds:(timeAmount asSeconds). |
d75cbe2e8ef7
addTime / subtractTime handle non-Number argument
Claus Gittinger <cg@exept.de>
parents:
6795
diff
changeset
|
695 |
]. |
3476
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
696 |
^ self addSeconds:timeAmount |
699 | 697 |
! |
698 |
||
6048
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
699 |
subtractDays:numberOfDays |
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
700 |
"return a new instance of myself, numberOfDays before." |
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
701 |
|
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
702 |
^ self subtractSeconds:(numberOfDays * (60 * 60 * 24)) |
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
703 |
|
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
704 |
" |
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
705 |
|t| |
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
706 |
|
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
707 |
t := Timestamp now. |
6048
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
708 |
Transcript showCR:t. |
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
709 |
Transcript showCR:(t subtractDays:50) |
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
710 |
" |
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
711 |
! |
af4b1127f362
refactored - some methods moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
6043
diff
changeset
|
712 |
|
699 | 713 |
subtractHours:numberOfHours |
714 |
"return a new instance of myself, numberOfHours before." |
|
715 |
||
716 |
^ self subtractSeconds:(numberOfHours * (60 * 60)) |
|
275 | 717 |
|
718 |
" |
|
719 |
|t| |
|
720 |
||
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
721 |
t := Timestamp now. |
3476
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
722 |
Transcript showCR:t. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
723 |
Transcript showCR:(t subtractHours:12). |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
724 |
" |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
725 |
|
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
726 |
" |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
727 |
|t| |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
728 |
|
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
729 |
t := Time now. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
730 |
Transcript showCR:t. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
731 |
Transcript showCR:(t subtractHours:12). |
275 | 732 |
" |
733 |
! |
|
734 |
||
6043
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
735 |
subtractMilliseconds:numberOfMilliSeconds |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
736 |
"return a new instance of myself, numberOfMilliSeconds before." |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
737 |
|
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
738 |
^ self species basicNew |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
739 |
setMilliseconds:(self getMilliseconds - numberOfMilliSeconds) |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
740 |
|
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
741 |
" |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
742 |
|t| |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
743 |
|
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
744 |
t := Timestamp now. |
6043
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
745 |
Transcript showCR:t. |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
746 |
Transcript showCR:(t subtractMilliseconds:100). |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
747 |
" |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
748 |
|
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
749 |
" |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
750 |
|t| |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
751 |
|
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
752 |
t := Time now. |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
753 |
Transcript showCR:t. |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
754 |
Transcript showCR:(t subtractMilliseconds:1000). |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
755 |
" |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
756 |
! |
ee486429674b
pushed up addMilliseconds/subtractMilliseconds
Claus Gittinger <cg@exept.de>
parents:
5968
diff
changeset
|
757 |
|
275 | 758 |
subtractMinutes:numberOfMinutes |
759 |
"return a new instance of myself, numberOfMinutes before." |
|
760 |
||
761 |
^ self subtractSeconds:(numberOfMinutes * 60) |
|
762 |
||
763 |
" |
|
764 |
|t| |
|
765 |
||
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
766 |
t := Timestamp now. |
3476
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
767 |
Transcript showCR:t. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
768 |
Transcript showCR:(t subtractMinutes:60). |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
769 |
" |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
770 |
|
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
771 |
" |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
772 |
|t| |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
773 |
|
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
774 |
t := Time now. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
775 |
Transcript showCR:t. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
776 |
Transcript showCR:(t subtractMinutes:60). |
275 | 777 |
" |
778 |
! |
|
779 |
||
699 | 780 |
subtractSeconds:numberOfSeconds |
781 |
"return a new instance of myself, numberOfSeconds before." |
|
275 | 782 |
|
3476
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
783 |
^ self species basicNew |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
784 |
setMilliseconds:(self getMilliseconds - (numberOfSeconds * 1000)) |
275 | 785 |
|
786 |
" |
|
787 |
|t| |
|
788 |
||
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
789 |
t := Timestamp now. |
3476
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
790 |
Transcript showCR:t. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
791 |
Transcript showCR:(t subtractSeconds:60). |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
792 |
" |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
793 |
|
275 | 794 |
" |
3476
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
795 |
|t| |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
796 |
|
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
797 |
t := Time now. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
798 |
Transcript showCR:t. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
799 |
Transcript showCR:(t subtractSeconds:60). |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
800 |
" |
275 | 801 |
! |
802 |
||
803 |
subtractTime:timeAmount |
|
3476
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
804 |
"return a new instance of myself, timeAmount seconds before myself. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
805 |
Provided for ST-80 compatibility. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
806 |
WARNING: |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
807 |
SubtractTime is a bad name - it does not add a time, but expects |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
808 |
a numberOfSeconds as argument. |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
809 |
Use any of addSeconds/addHours etc. to make things clear" |
275 | 810 |
|
6888
d75cbe2e8ef7
addTime / subtractTime handle non-Number argument
Claus Gittinger <cg@exept.de>
parents:
6795
diff
changeset
|
811 |
timeAmount isNumber ifFalse:[ |
d75cbe2e8ef7
addTime / subtractTime handle non-Number argument
Claus Gittinger <cg@exept.de>
parents:
6795
diff
changeset
|
812 |
^ self subtractSeconds:(timeAmount asSeconds). |
d75cbe2e8ef7
addTime / subtractTime handle non-Number argument
Claus Gittinger <cg@exept.de>
parents:
6795
diff
changeset
|
813 |
]. |
3476
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
814 |
^ self subtractSeconds:timeAmount |
f2ebb76a952d
dont loose milliseconds when adding seconds to a Timestamp.
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
815 |
|
275 | 816 |
! ! |
817 |
||
5573
efd0dc6578ac
#-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
5548
diff
changeset
|
818 |
!AbstractTime methodsFor:'comparing'! |
efd0dc6578ac
#-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
5548
diff
changeset
|
819 |
|
efd0dc6578ac
#-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
5548
diff
changeset
|
820 |
< aTime |
efd0dc6578ac
#-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
5548
diff
changeset
|
821 |
"return true if the receiver is before the argument" |
efd0dc6578ac
#-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
5548
diff
changeset
|
822 |
|
efd0dc6578ac
#-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
5548
diff
changeset
|
823 |
^ self getMilliseconds < aTime getMilliseconds |
efd0dc6578ac
#-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
5548
diff
changeset
|
824 |
|
efd0dc6578ac
#-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
5548
diff
changeset
|
825 |
"Modified: 3.7.1996 / 13:10:17 / cg" |
efd0dc6578ac
#-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
5548
diff
changeset
|
826 |
! |
efd0dc6578ac
#-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
5548
diff
changeset
|
827 |
|
efd0dc6578ac
#-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
5548
diff
changeset
|
828 |
> aTime |
efd0dc6578ac
#-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
5548
diff
changeset
|
829 |
"return true if the receiver is after the argument" |
efd0dc6578ac
#-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
5548
diff
changeset
|
830 |
|
efd0dc6578ac
#-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
5548
diff
changeset
|
831 |
^ self getMilliseconds > aTime getMilliseconds |
efd0dc6578ac
#-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
5548
diff
changeset
|
832 |
|
efd0dc6578ac
#-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
5548
diff
changeset
|
833 |
"Modified: 1.7.1996 / 15:24:38 / cg" |
efd0dc6578ac
#-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
5548
diff
changeset
|
834 |
! ! |
efd0dc6578ac
#-, #< and #> moved from AbsoluteTime
Claus Gittinger <cg@exept.de>
parents:
5548
diff
changeset
|
835 |
|
8200 | 836 |
!AbstractTime methodsFor:'converting'! |
837 |
||
838 |
asAbsoluteTime |
|
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
839 |
"deprecated, use #asTimestamp" |
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
840 |
<resource:#obsolete> |
8200 | 841 |
|
17732
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
842 |
self obsoleteMethodWarning:'use #asTimestamp'. |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
843 |
^ self asTimestamp |
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
844 |
! |
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
845 |
|
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
846 |
asTimestamp |
8200 | 847 |
^ self subclassResponsibility |
848 |
! ! |
|
849 |
||
11518 | 850 |
!AbstractTime methodsFor:'double dispatching'! |
851 |
||
852 |
differenceFromTimestamp:aTimestamp |
|
853 |
^ aTimestamp getSeconds - self getSeconds |
|
854 |
! ! |
|
855 |
||
4649
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
856 |
!AbstractTime methodsFor:'printing & storing'! |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
857 |
|
4844 | 858 |
addPrintBindingsTo:aDictionary |
8111
67347b7e3e69
print bindings (care for language specifics)
Claus Gittinger <cg@exept.de>
parents:
7672
diff
changeset
|
859 |
"private print support: add bindings for printing to aDictionary." |
67347b7e3e69
print bindings (care for language specifics)
Claus Gittinger <cg@exept.de>
parents:
7672
diff
changeset
|
860 |
|
67347b7e3e69
print bindings (care for language specifics)
Claus Gittinger <cg@exept.de>
parents:
7672
diff
changeset
|
861 |
self addPrintBindingsTo:aDictionary language:nil |
67347b7e3e69
print bindings (care for language specifics)
Claus Gittinger <cg@exept.de>
parents:
7672
diff
changeset
|
862 |
! |
67347b7e3e69
print bindings (care for language specifics)
Claus Gittinger <cg@exept.de>
parents:
7672
diff
changeset
|
863 |
|
67347b7e3e69
print bindings (care for language specifics)
Claus Gittinger <cg@exept.de>
parents:
7672
diff
changeset
|
864 |
addPrintBindingsTo:aDictionary language:languageOrNil |
67347b7e3e69
print bindings (care for language specifics)
Claus Gittinger <cg@exept.de>
parents:
7672
diff
changeset
|
865 |
"private print support: add bindings for printing to aDictionary. |
17728
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
866 |
languageOrNil can only be #en or nil for the current language. |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
867 |
bindings: |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
868 |
%h hours, 00..23 (i.e. european) 0-padded to length 2 |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
869 |
%u hours, 00..12 (i.e. us) 0-padded to length 2 |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
870 |
%m minutes, 00..59 0-padded to length 2 |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
871 |
%s seconds, 00..59 0-padded to length 2 |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
872 |
%i milliseconds, 000..999 0-padded to length 3 |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
873 |
%a am/pm |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
874 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
875 |
Timestamp only: |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
876 |
%(day) day, 00..31 0-padded to length 2 |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
877 |
%(month) month, 00..12 0-padded to length 2 |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
878 |
%(year) year, 4 digits 0-padded to length 4 |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
879 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
880 |
special: |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
881 |
%H 24-hours - unpadded |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
882 |
%U 12-hours - unpadded |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
883 |
%M minutes - unpadded |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
884 |
%S seconds - unpadded |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
885 |
%I milliseconds, unpadded |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
886 |
%A AM/PM - uppercase |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
887 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
888 |
%t seconds within hour (unpadded) |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
889 |
%T seconds from midNight (unpadded) |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
890 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
891 |
%(TZD) timeZone delta from UTC in the format +/-hh:mm |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
892 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
893 |
%milli1 milliseconds, truncated to 1/10th of a second 0..9 |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
894 |
%milli2 milliseconds, truncated to 1/100th of a second 00..99 0-padded to length 2 |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
895 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
896 |
%nth - counting day-in-month (1->'st'; 2->'nd'; 3->'rd'; 4...->'th') |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
897 |
%weekDayNth - counting day-in-week (1->'st'; 2->'nd'; 3->'rd'; 4...->'th') |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
898 |
%weekNth - counting week-in-year (1->'st'; 2->'nd'; 3->'rd'; 4...->'th') |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
899 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
900 |
Timestamp only: |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
901 |
%Day day - unpadded |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
902 |
%Month month - unpadded |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
903 |
%(yearOrTime) year or time 5 digits as in unix-ls: |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
904 |
year if it is not the current year; |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
905 |
time otherwise |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
906 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
907 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
908 |
The ISO8601 printString are generated with: |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
909 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
910 |
Year: |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
911 |
YYYY (eg 1997) |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
912 |
Date today printStringFormat:'%(year)' |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
913 |
Timestamp now printStringFormat:'%(year)' |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
914 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
915 |
Year and month: |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
916 |
YYYY-MM (eg 1997-07) |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
917 |
Date today printStringFormat:'%(year)-%(month)' |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
918 |
Timestamp now printStringFormat:'%(year)-%(month)' |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
919 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
920 |
Complete date: |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
921 |
YYYY-MM-DD (eg 1997-07-16) |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
922 |
Date today printStringFormat:'%(year)-%(month)-%(day)' |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
923 |
Timestamp now printStringFormat:'%(year)-%(month)-%(day)' |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
924 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
925 |
Complete date plus hours and minutes: |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
926 |
YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00) |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
927 |
Timestamp now printStringFormat:'%(year)-%(month)-%(day)T%h:%m%(TZD)' |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
928 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
929 |
Complete date plus hours, minutes and seconds: |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
930 |
YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00) |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
931 |
Timestamp now printStringFormat:'%(year)-%(month)-%(day)T%h:%m:%s%(TZD)' |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
932 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
933 |
Complete date plus hours, minutes, seconds and a decimal fraction of a second |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
934 |
YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00) |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
935 |
Timestamp now printStringFormat:'%(year)-%(month)-%(day)T%h:%m:%s.%(milli2)%(TZD)' |
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
936 |
|
bbc5fa73dfab
Merged with trunk r10466
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
937 |
" |
4844 | 938 |
|
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
939 |
|hours minutes seconds millis usHours ampm s zone tzDelta| |
4844 | 940 |
|
941 |
hours := self hours. |
|
942 |
minutes := self minutes. |
|
943 |
seconds := self seconds. |
|
944 |
millis := self milliseconds. |
|
5968 | 945 |
zone := self timeZoneName. |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
946 |
tzDelta := self timeZoneDeltaInMinutes. |
4844 | 947 |
|
6419 | 948 |
ampm := self meridianAbbreviation. |
949 |
usHours := self hour12. |
|
4844 | 950 |
|
951 |
aDictionary at:$H put:(s := hours printString). |
|
952 |
aDictionary at:$h put:(s leftPaddedTo:2 with:$0). |
|
953 |
aDictionary at:$U put:(s := usHours printString). |
|
954 |
aDictionary at:$u put:(s leftPaddedTo:2 with:$0). |
|
955 |
aDictionary at:$M put:(s := minutes printString). |
|
956 |
aDictionary at:$m put:(s leftPaddedTo:2 with:$0). |
|
957 |
aDictionary at:$S put:(s := seconds printString). |
|
958 |
aDictionary at:$s put:(s leftPaddedTo:2 with:$0). |
|
959 |
aDictionary at:$I put:(s := millis printString). |
|
960 |
aDictionary at:$i put:(s leftPaddedTo:3 with:$0). |
|
4904
33d322c419ba
more format strings for milliseconds.
Claus Gittinger <cg@exept.de>
parents:
4844
diff
changeset
|
961 |
aDictionary at:#milli1 put:((millis // 100) printString). |
33d322c419ba
more format strings for milliseconds.
Claus Gittinger <cg@exept.de>
parents:
4844
diff
changeset
|
962 |
aDictionary at:#milli2 put:((millis // 10) printStringLeftPaddedTo:2 with:$0). |
4844 | 963 |
aDictionary at:$t put:(seconds * minutes) printString. |
964 |
aDictionary at:$T put:(seconds * minutes * hours) printString. |
|
965 |
aDictionary at:$a put:ampm. |
|
966 |
aDictionary at:$A put:ampm asUppercase. |
|
5968 | 967 |
aDictionary at:$z put:zone. |
968 |
aDictionary at:$Z put:zone asUppercase. |
|
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
969 |
|
9432 | 970 |
tzDelta == 0 ifTrue:[ |
971 |
s := 'Z'. |
|
972 |
] ifFalse:[ |
|
973 |
s := tzDelta < 0 ifTrue:[ '-' ] ifFalse:[ '+' ]. |
|
974 |
tzDelta := tzDelta abs. |
|
975 |
s := s , ((tzDelta // 60) printStringLeftPaddedTo:2 with:$0), |
|
976 |
':' , ((tzDelta \\ 60) printStringLeftPaddedTo:2 with:$0). |
|
977 |
]. |
|
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
978 |
aDictionary at:#TZD put:s |
4844 | 979 |
! |
980 |
||
4649
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
981 |
printOn:aStream format:aFormatString |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
982 |
"print using a format string; |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
983 |
valid format items are: |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
984 |
%h hours, 00..23 (i.e. european) 0-padded to length 2 |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
985 |
%u hours, 00..12 (i.e. us) 0-padded to length 2 |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
986 |
%m minutes, 00..59 0-padded to length 2 |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
987 |
%s seconds, 00..59 0-padded to length 2 |
4841 | 988 |
%i milliseconds, 000..999 0-padded to length 3 |
4649
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
989 |
%a am/pm |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
990 |
|
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
991 |
Timestamp only: |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
992 |
%(day) day, 00..31 0-padded to length 2 |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
993 |
%(month) month, 00..12 0-padded to length 2 |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
994 |
%(year) year, 4 digits 0-padded to length 4 |
4844 | 995 |
|
4649
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
996 |
special: |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
997 |
%H 24-hours - unpadded |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
998 |
%U 12-hours - unpadded |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
999 |
%M minutes - unpadded |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1000 |
%S seconds - unpadded |
4840
e97f4f2339d9
added milliseconds in printFormat
Claus Gittinger <cg@exept.de>
parents:
4835
diff
changeset
|
1001 |
%I milliseconds, unpadded |
4649
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1002 |
%A AM/PM - uppercase |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1003 |
|
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1004 |
%t seconds within hour (unpadded) |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1005 |
%T seconds from midNight (unpadded) |
4844 | 1006 |
|
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1007 |
%(TZD) timeZone delta from UTC in the format +/-hh:mm |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1008 |
|
4904
33d322c419ba
more format strings for milliseconds.
Claus Gittinger <cg@exept.de>
parents:
4844
diff
changeset
|
1009 |
%milli1 milliseconds, truncated to 1/10th of a second 0..9 |
33d322c419ba
more format strings for milliseconds.
Claus Gittinger <cg@exept.de>
parents:
4844
diff
changeset
|
1010 |
%milli2 milliseconds, truncated to 1/100th of a second 00..99 0-padded to length 2 |
33d322c419ba
more format strings for milliseconds.
Claus Gittinger <cg@exept.de>
parents:
4844
diff
changeset
|
1011 |
|
7327 | 1012 |
%nth - counting day-in-month (1->'st'; 2->'nd'; 3->'rd'; 4...->'th') |
1013 |
%weekDayNth - counting day-in-week (1->'st'; 2->'nd'; 3->'rd'; 4...->'th') |
|
1014 |
%weekNth - counting week-in-year (1->'st'; 2->'nd'; 3->'rd'; 4...->'th') |
|
1015 |
||
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
1016 |
Timestamp only: |
4844 | 1017 |
%Day day - unpadded |
4929 | 1018 |
%Month month - unpadded |
6795
519894240d97
more printFormats: yearOrDate (as in unix); dayPadded and monthPadded
penk
parents:
6419
diff
changeset
|
1019 |
%(yearOrTime) year or time 5 digits as in unix-ls: |
519894240d97
more printFormats: yearOrDate (as in unix); dayPadded and monthPadded
penk
parents:
6419
diff
changeset
|
1020 |
year if it is not the current year; |
519894240d97
more printFormats: yearOrDate (as in unix); dayPadded and monthPadded
penk
parents:
6419
diff
changeset
|
1021 |
time otherwise |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1022 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1023 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1024 |
The ISO8601 printString are generated with: |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1025 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1026 |
Year: |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1027 |
YYYY (eg 1997) |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1028 |
Date today printStringFormat:'%(year)' |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
1029 |
Timestamp now printStringFormat:'%(year)' |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1030 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1031 |
Year and month: |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1032 |
YYYY-MM (eg 1997-07) |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1033 |
Date today printStringFormat:'%(year)-%(month)' |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
1034 |
Timestamp now printStringFormat:'%(year)-%(month)' |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1035 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1036 |
Complete date: |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1037 |
YYYY-MM-DD (eg 1997-07-16) |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1038 |
Date today printStringFormat:'%(year)-%(month)-%(day)' |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
1039 |
Timestamp now printStringFormat:'%(year)-%(month)-%(day)' |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1040 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1041 |
Complete date plus hours and minutes: |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1042 |
YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00) |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
1043 |
Timestamp now printStringFormat:'%(year)-%(month)-%(day)T%h:%m%(TZD)' |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1044 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1045 |
Complete date plus hours, minutes and seconds: |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1046 |
YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00) |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
1047 |
Timestamp now printStringFormat:'%(year)-%(month)-%(day)T%h:%m:%s%(TZD)' |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1048 |
|
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1049 |
Complete date plus hours, minutes, seconds and a decimal fraction of a second |
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1050 |
YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00) |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
1051 |
Timestamp now printStringFormat:'%(year)-%(month)-%(day)T%h:%m:%s.%(milli2)%(TZD)' |
6172
a3c88ea5efe9
comment and iso8601 (time/date formats) fixes
Claus Gittinger <cg@exept.de>
parents:
6048
diff
changeset
|
1052 |
|
4649
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1053 |
" |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1054 |
|
4844 | 1055 |
|dict| |
4649
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1056 |
|
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1057 |
dict := IdentityDictionary new. |
4844 | 1058 |
self addPrintBindingsTo:dict. |
4649
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1059 |
|
10907
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1060 |
aFormatString expandPlaceholdersWith:dict on:aStream |
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1061 |
|
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1062 |
" |
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1063 |
Timestamp now printOn:Transcript format:'%h:%m:%s' . Transcript cr. |
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1064 |
Time now printOn:Transcript format:'%h:%m:%s' . Transcript cr. |
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1065 |
Time now printOn:Transcript format:'%H:%m:%s' . Transcript cr. |
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1066 |
Time now printOn:Transcript format:'%u:%m:%s %a'. Transcript cr. |
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1067 |
Time now printOn:Transcript format:'%h:%m' . Transcript cr. |
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1068 |
Time now printOn:Transcript format:'%H:%m %A' . Transcript cr. |
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1069 |
Time now printOn:Transcript format:'minutes:%M seconds:%S'. Transcript cr. |
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1070 |
" |
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1071 |
|
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1072 |
"Modified: 22.2.1996 / 16:58:30 / cg" |
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1073 |
! |
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1074 |
|
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1075 |
printStringFormat:aFormatString |
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1076 |
"print using a format string - see #printOn:format:" |
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1077 |
|
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1078 |
|s| |
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1079 |
|
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1080 |
s := WriteStream on:(String new:20). |
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1081 |
self printOn:s format:aFormatString. |
8b98ba82a46f
Now printStringXXXX uses printOn:XXXX.
Stefan Vogel <sv@exept.de>
parents:
10770
diff
changeset
|
1082 |
^ s contents. |
4649
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1083 |
|
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1084 |
" |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
1085 |
Timestamp now printStringFormat:'%U:%m:%s %a' |
4649
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1086 |
Time now printStringFormat:'%U:%m:%s %a' |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1087 |
|
4844 | 1088 |
Time now printStringFormat:'%h:%m:%s' |
4649
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1089 |
Time now printStringFormat:'%H:%m:%s' |
4844 | 1090 |
Time now printStringFormat:'%H:%m:%s.%i' |
8256
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
1091 |
Timestamp now printStringFormat:'%H:%m:%s.%i' |
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
1092 |
Timestamp now printStringFormat:'%H:%m:%s.%(milli1)' |
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
1093 |
Timestamp now printStringFormat:'%H:%m:%s.%(milli2)' |
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
1094 |
Timestamp now printStringFormat:'%(day)-%(month)-%(year) :%m:%s' |
4c3d944ef85a
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8244
diff
changeset
|
1095 |
Timestamp now printStringFormat:'%(day)-%(monthName)-%(year) :%m:%s' |
4649
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1096 |
Time now printStringFormat:'%u:%m:%s %a' |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1097 |
Time now printStringFormat:'%h:%m' |
4844 | 1098 |
Time now printStringFormat:'%h:%m' |
4649
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1099 |
Time now printStringFormat:'%H:%m %A' |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1100 |
Time now printStringFormat:'%m minutes after %U %a' |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1101 |
Time now printStringFormat:'%t seconds after %U %a' |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1102 |
Time now printStringFormat:'%T seconds from midNight' |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1103 |
" |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1104 |
|
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1105 |
"Modified: 22.2.1996 / 16:58:30 / cg" |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1106 |
! ! |
3eaf75dd8973
Move printOn:format: to AbstractTime
Stefan Vogel <sv@exept.de>
parents:
3476
diff
changeset
|
1107 |
|
699 | 1108 |
!AbstractTime methodsFor:'private'! |
240 | 1109 |
|
1500
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
1110 |
fromOSTime:osTime |
699 | 1111 |
"set my time, from operatingSystems time parts" |
240 | 1112 |
|
1500
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
1113 |
^ self subclassResponsibility |
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
1114 |
|
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
1115 |
"Modified: 1.7.1996 / 15:09:44 / cg" |
240 | 1116 |
! |
1117 |
||
1500
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
1118 |
getMilliseconds |
8200 | 1119 |
"get the milliseconds since some point of time in the past. |
1500
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
1120 |
Since I am abstract (not knowing how the time is actually |
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
1121 |
represented), this must be done by a concrete class." |
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
1122 |
|
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
1123 |
^ self subclassResponsibility |
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
1124 |
|
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
1125 |
"Created: 1.7.1996 / 14:16:49 / cg" |
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
1126 |
! |
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
1127 |
|
699 | 1128 |
getSeconds |
8200 | 1129 |
"get the seconds since some point of time in the past. |
699 | 1130 |
Since I am abstract (not knowing how the time is actually |
1131 |
represented), this must be done by a concrete class." |
|
240 | 1132 |
|
699 | 1133 |
^ self subclassResponsibility |
1134 |
! |
|
1135 |
||
1500
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
1136 |
setMilliseconds:millis |
8200 | 1137 |
"set the milliseconds since some point of time in the past. |
1500
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
1138 |
Since I am abstract (not knowing how the time is actually |
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
1139 |
represented), this must be done by a concrete class." |
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
1140 |
|
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
1141 |
^ self subclassResponsibility |
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
1142 |
|
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
1143 |
"Created: 1.7.1996 / 14:17:00 / cg" |
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
1144 |
! |
d42e61e53cee
changed osTime to a largeInt, which includes the milliseconds
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
1145 |
|
699 | 1146 |
setSeconds:secs |
8200 | 1147 |
"set the seconds since some point of time in the past. |
699 | 1148 |
Since I am abstract (not knowing how the time is actually |
1149 |
represented), this must be done by a concrete class." |
|
1150 |
||
1151 |
^ self subclassResponsibility |
|
240 | 1152 |
! ! |
1153 |
||
2310
2cb1366e0eb3
Correct name: #secondDay --> #secondInDay.
Stefan Vogel <sv@exept.de>
parents:
1500
diff
changeset
|
1154 |
!AbstractTime class methodsFor:'documentation'! |
240 | 1155 |
|
699 | 1156 |
version |
17767 | 1157 |
^ '$Id: AbstractTime.st 10527 2010-06-16 20:12:05Z vranyj1 $' |
17747 | 1158 |
! |
1159 |
||
1160 |
version_CVS |
|
17767 | 1161 |
^ 'Header: /cvs/stx/stx/libbasic/AbstractTime.st,v 1.68 2010-03-31 13:52:36 stefan Exp ยง' |
17761
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17757
diff
changeset
|
1162 |
! |
17732
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17728
diff
changeset
|
1163 |
|
17761
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17757
diff
changeset
|
1164 |
version_SVN |
17767 | 1165 |
^ '$Id: AbstractTime.st 10527 2010-06-16 20:12:05Z vranyj1 $' |
17761
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17757
diff
changeset
|
1166 |
! ! |
17767 | 1167 |