]>
Commit | Line | Data |
---|---|---|
22f22798 | 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
f6bcfd97 BP |
2 | %% Name: datespan.tex |
3 | %% Purpose: wxDateSpan documentation | |
4 | %% Author: Vadim Zeitlin | |
5 | %% Modified by: | |
6 | %% Created: 04.04.00 | |
7 | %% RCS-ID: $Id$ | |
8 | %% Copyright: (c) Vadim Zeitlin | |
8795498c | 9 | %% License: wxWindows license |
f6bcfd97 BP |
10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
11 | ||
12 | \section{\class{wxTimeSpan}}\label{wxtimespan} | |
13 | ||
df05cdc5 VZ |
14 | wxTimeSpan class represents a time interval. |
15 | ||
16 | \wxheading{Derived from} | |
17 | ||
18 | No base class | |
19 | ||
20 | \wxheading{Include files} | |
21 | ||
22 | <wx/datetime.h> | |
23 | ||
a7af285d VZ |
24 | \wxheading{Library} |
25 | ||
26 | \helpref{wxBase}{librarieslist} | |
27 | ||
df05cdc5 VZ |
28 | \wxheading{See also} |
29 | ||
30 | \helpref{Date classes overview}{wxdatetimeoverview},\rtfsp | |
31 | \helpref{wxDateTime}{wxdatetime} | |
32 | ||
33 | \latexignore{\rtfignore{\wxheading{Function groups}}} | |
34 | ||
bd35ed32 | 35 | |
6d06e061 | 36 | \membersection{Static functions}\label{timespanstaticfunctions} |
df05cdc5 | 37 | |
bd35ed32 VZ |
38 | \helpref{Milliseconds}{wxtimespanmilliseconds}\\ |
39 | \helpref{Millisecond}{wxtimespanmillisecond}\\ | |
22f22798 JS |
40 | \helpref{Seconds}{wxtimespanseconds}\\ |
41 | \helpref{Second}{wxtimespansecond}\\ | |
42 | \helpref{Minutes}{wxtimespanminutes}\\ | |
43 | \helpref{Minute}{wxtimespanminute}\\ | |
44 | \helpref{Hours}{wxtimespanhours}\\ | |
45 | \helpref{Hour}{wxtimespanhour}\\ | |
46 | \helpref{Days}{wxtimespandays}\\ | |
47 | \helpref{Day}{wxtimespanday}\\ | |
48 | \helpref{Weeks}{wxtimespanweeks}\\ | |
49 | \helpref{Week}{wxtimespanweek} | |
50 | ||
bd35ed32 | 51 | |
6d06e061 | 52 | \membersection{Constructors}\label{timespanconstructors} |
df05cdc5 | 53 | |
5283098e | 54 | \helpref{wxTimeSpan}{wxtimespanctor} |
df05cdc5 | 55 | |
bd35ed32 | 56 | |
6d06e061 | 57 | \membersection{Accessors}\label{timespanaccessors} |
df05cdc5 | 58 | |
22f22798 JS |
59 | \helpref{GetSeconds}{wxtimespangetseconds}\\ |
60 | \helpref{GetMinutes}{wxtimespangetminutes}\\ | |
61 | \helpref{GetHours}{wxtimespangethours}\\ | |
62 | \helpref{GetDays}{wxtimespangetdays}\\ | |
63 | \helpref{GetWeeks}{wxtimespangetweeks}\\ | |
64 | \helpref{GetValue}{wxtimespangetvalue} | |
65 | ||
bd35ed32 | 66 | |
6d06e061 | 67 | \membersection{Operations}\label{timespanoperations} |
df05cdc5 | 68 | |
22f22798 | 69 | \helpref{Add}{wxtimespanadd}\\ |
dbd94b75 | 70 | \helpref{Subtract}{wxtimespansubtract}\\ |
22f22798 JS |
71 | \helpref{Multiply}{wxtimespanmultiply}\\ |
72 | \helpref{Negate}{wxtimespannegate}\\ | |
73 | \helpref{Neg}{wxtimespanneg}\\ | |
74 | \helpref{Abs}{wxtimespanabs} | |
75 | ||
bd35ed32 | 76 | |
6d06e061 | 77 | \membersection{Tests}\label{timespantests} |
df05cdc5 | 78 | |
22f22798 JS |
79 | \helpref{IsNull}{wxtimespanisnull}\\ |
80 | \helpref{IsPositive}{wxtimespanispositive}\\ | |
81 | \helpref{IsNegative}{wxtimespanisnegative}\\ | |
82 | \helpref{IsEqualTo}{wxtimespanisequalto}\\ | |
83 | \helpref{IsLongerThan}{wxtimespanislongerthan}\\ | |
84 | \helpref{IsShorterThan}{wxtimespanisshorterthan} | |
85 | ||
bd35ed32 | 86 | |
6d06e061 | 87 | \membersection{Formatting time spans}\label{timespanformatting} |
df05cdc5 VZ |
88 | |
89 | \helpref{Format}{wxtimespanformat} | |
90 | ||
91 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
92 | % Start of member function part % | |
93 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
94 | ||
95 | \helponly{\insertatlevel{2}{ | |
96 | \wxheading{Members} | |
97 | }} | |
98 | ||
bd35ed32 | 99 | |
22f22798 JS |
100 | \membersection{wxTimeSpan::Abs}\label{wxtimespanabs} |
101 | ||
102 | \constfunc{wxTimeSpan}{Abs}{\void} | |
103 | ||
104 | Returns the absolute value of the timespan: does not modify the | |
105 | object. | |
106 | ||
bd35ed32 | 107 | |
22f22798 JS |
108 | \membersection{wxTimeSpan::Add}\label{wxtimespanadd} |
109 | ||
110 | \constfunc{wxTimeSpan}{Add}{\param{const wxTimeSpan\& }{diff}} | |
111 | ||
112 | \func{wxTimeSpan\&}{Add}{\param{const wxTimeSpan\& }{diff}} | |
113 | ||
114 | \func{wxTimeSpan\&}{operator$+=$}{\param{const wxTimeSpan\&}{diff}} | |
115 | ||
116 | Returns the sum of two timespans. | |
117 | ||
bd35ed32 | 118 | |
22f22798 JS |
119 | \membersection{wxTimeSpan::Days}\label{wxtimespandays} |
120 | ||
121 | \func{static wxTimespan}{Days}{\param{long }{days}} | |
122 | ||
123 | Returns the timespan for the given number of days. | |
124 | ||
bd35ed32 | 125 | |
22f22798 JS |
126 | \membersection{wxTimeSpan::Day}\label{wxtimespanday} |
127 | ||
128 | \func{static wxTimespan}{Day}{\void} | |
129 | ||
130 | Returns the timespan for one day. | |
131 | ||
bd35ed32 | 132 | |
df05cdc5 VZ |
133 | \membersection{wxTimeSpan::Format}\label{wxtimespanformat} |
134 | ||
1aaf88d2 | 135 | \func{wxString}{Format}{\param{const wxChar * }{format = wxDefaultTimeSpanFormat}} |
df05cdc5 VZ |
136 | |
137 | Returns the string containing the formatted representation of the time span. | |
138 | The following format specifiers are allowed after \%: | |
139 | ||
140 | \twocolwidtha{5cm}% | |
141 | \begin{twocollist}\itemsep=0pt | |
142 | \twocolitem{H}{number of {\bf H}ours} | |
143 | \twocolitem{M}{number of {\bf M}inutes} | |
144 | \twocolitem{S}{number of {\bf S}econds} | |
145 | \twocolitem{l}{number of mi{\bf l}liseconds} | |
146 | \twocolitem{D}{number of {\bf D}ays} | |
147 | \twocolitem{E}{number of w{\bf E}eks} | |
148 | \twocolitem{\%}{the percent character} | |
149 | \end{twocollist} | |
150 | ||
151 | Note that, for example, the number of hours in the description above is not | |
152 | well defined: it can be either the total number of hours (for example, for a | |
153 | time span of $50$ hours this would be $50$) or just the hour part of the time | |
154 | span, which would be $2$ in this case as $50$ hours is equal to $2$ days and | |
155 | $2$ hours. | |
156 | ||
157 | wxTimeSpan resolves this ambiguity in the following way: if there had been, | |
158 | indeed, the {\tt \%D} format specified preceding the {\tt \%H}, then it is | |
159 | interpreted as $2$. Otherwise, it is $50$. | |
160 | ||
161 | The same applies to all other format specifiers: if they follow a specifier of | |
162 | larger unit, only the rest part is taken, otherwise the full value is used. | |
f6bcfd97 | 163 | |
bd35ed32 | 164 | |
22f22798 JS |
165 | \membersection{wxTimeSpan::GetDays}\label{wxtimespangetdays} |
166 | ||
167 | \constfunc{int}{GetDays}{\void} | |
168 | ||
169 | Returns the difference in number of days. | |
170 | ||
bd35ed32 | 171 | |
22f22798 JS |
172 | \membersection{wxTimeSpan::GetHours}\label{wxtimespangethours} |
173 | ||
174 | \constfunc{int}{GetHours}{\void} | |
175 | ||
176 | Returns the difference in number of hours. | |
177 | ||
bd35ed32 | 178 | |
22f22798 JS |
179 | \membersection{wxTimeSpan::GetMilliseconds}\label{wxtimespangetmilliseconds} |
180 | ||
181 | \constfunc{wxLongLong}{GetMilliseconds}{\void} | |
182 | ||
183 | Returns the difference in number of milliseconds. | |
184 | ||
bd35ed32 | 185 | |
22f22798 JS |
186 | \membersection{wxTimeSpan::GetMinutes}\label{wxtimespangetminutes} |
187 | ||
188 | \constfunc{int}{GetMinutes}{\void} | |
189 | ||
190 | Returns the difference in number of minutes. | |
191 | ||
bd35ed32 | 192 | |
22f22798 JS |
193 | \membersection{wxTimeSpan::GetSeconds}\label{wxtimespangetseconds} |
194 | ||
195 | \constfunc{wxLongLong}{GetSeconds}{\void} | |
196 | ||
197 | Returns the difference in number of seconds. | |
198 | ||
bd35ed32 | 199 | |
22f22798 JS |
200 | \membersection{wxTimeSpan::GetValue}\label{wxtimespangetvalue} |
201 | ||
202 | \constfunc{wxLongLong}{GetValue}{\void} | |
203 | ||
204 | Returns the internal representation of timespan. | |
205 | ||
bd35ed32 | 206 | |
22f22798 JS |
207 | \membersection{wxTimeSpan::GetWeeks}\label{wxtimespangetweeks} |
208 | ||
209 | \constfunc{int}{GetWeeks}{\void} | |
210 | ||
211 | Returns the difference in number of weeks. | |
212 | ||
bd35ed32 | 213 | |
22f22798 JS |
214 | \membersection{wxTimeSpan::Hours}\label{wxtimespanhours} |
215 | ||
216 | \func{static wxTimespan}{Hours}{\param{long }{hours}} | |
217 | ||
218 | Returns the timespan for the given number of hours. | |
219 | ||
bd35ed32 | 220 | |
22f22798 JS |
221 | \membersection{wxTimeSpan::Hour}\label{wxtimespanhour} |
222 | ||
223 | \func{static wxTimespan}{Hour}{\void} | |
224 | ||
225 | Returns the timespan for one hour. | |
226 | ||
bd35ed32 | 227 | |
22f22798 JS |
228 | \membersection{wxTimeSpan::IsEqualTo}\label{wxtimespanisequalto} |
229 | ||
230 | \constfunc{bool}{IsEqualTo}{\param{const wxTimeSpan\& }{ts}} | |
231 | ||
cc81d32f | 232 | Returns {\tt true} if two timespans are equal. |
22f22798 | 233 | |
bd35ed32 | 234 | |
22f22798 JS |
235 | \membersection{wxTimeSpan::IsLongerThan}\label{wxtimespanislongerthan} |
236 | ||
237 | \constfunc{bool}{IsLongerThan}{\param{const wxTimeSpan\& }{ts}} | |
238 | ||
239 | Compares two timespans: works with the absolute values, i.e. -2 | |
cc81d32f | 240 | hours is longer than 1 hour. Also, it will return {\tt false} if |
22f22798 JS |
241 | the timespans are equal in absolute value. |
242 | ||
bd35ed32 | 243 | |
22f22798 JS |
244 | \membersection{wxTimeSpan::IsNegative}\label{wxtimespanisnegative} |
245 | ||
246 | \constfunc{bool}{IsNegative}{\void} | |
247 | ||
cc81d32f | 248 | Returns {\tt true} if the timespan is negative. |
22f22798 | 249 | |
bd35ed32 | 250 | |
22f22798 JS |
251 | \membersection{wxTimeSpan::IsNull}\label{wxtimespanisnull} |
252 | ||
253 | \constfunc{bool}{IsNull}{\void} | |
254 | ||
cc81d32f | 255 | Returns {\tt true} if the timespan is empty. |
22f22798 | 256 | |
bd35ed32 | 257 | |
22f22798 JS |
258 | \membersection{wxTimeSpan::IsPositive}\label{wxtimespanispositive} |
259 | ||
260 | \constfunc{bool}{IsPositive}{\void} | |
261 | ||
cc81d32f | 262 | Returns {\tt true} if the timespan is positive. |
22f22798 | 263 | |
bd35ed32 | 264 | |
22f22798 JS |
265 | \membersection{wxTimeSpan::IsShorterThan}\label{wxtimespanisshorterthan} |
266 | ||
267 | \constfunc{bool}{IsShorterThan}{\param{const wxTimeSpan\& }{ts}} | |
268 | ||
269 | Compares two timespans: works with the absolute values, i.e. 1 | |
cc81d32f | 270 | hour is shorter than -2 hours. Also, it will return {\tt false} if |
22f22798 JS |
271 | the timespans are equal in absolute value. |
272 | ||
bd35ed32 | 273 | |
22f22798 JS |
274 | \membersection{wxTimeSpan::Minutes}\label{wxtimespanminutes} |
275 | ||
276 | \func{static wxTimespan}{Minutes}{\param{long }{min}} | |
277 | ||
278 | Returns the timespan for the given number of minutes. | |
279 | ||
bd35ed32 | 280 | |
22f22798 JS |
281 | \membersection{wxTimeSpan::Minute}\label{wxtimespanminute} |
282 | ||
283 | \func{static wxTimespan}{Minute}{\void} | |
284 | ||
285 | Returns the timespan for one minute. | |
286 | ||
bd35ed32 | 287 | |
22f22798 JS |
288 | \membersection{wxTimeSpan::Multiply}\label{wxtimespanmultiply} |
289 | ||
290 | \constfunc{wxTimeSpan}{Multiply}{\param{int }{n}} | |
291 | ||
292 | \func{wxTimeSpan\&}{Multiply}{\param{int }{n}} | |
293 | ||
294 | \func{wxTimeSpan\&}{operator$*=$}{\param{int }{n}} | |
295 | ||
296 | Multiplies timespan by a scalar. | |
297 | ||
bd35ed32 | 298 | |
22f22798 JS |
299 | \membersection{wxTimeSpan::Negate}\label{wxtimespannegate} |
300 | ||
301 | \constfunc{wxTimeSpan}{Negate}{\void} | |
302 | ||
dbd94b75 | 303 | Returns timespan with inverted sign. |
22f22798 | 304 | |
bd35ed32 | 305 | |
22f22798 JS |
306 | \membersection{wxTimeSpan::Neg}\label{wxtimespanneg} |
307 | ||
308 | \func{wxTimeSpan\&}{Neg}{\void} | |
309 | ||
310 | \func{wxTimeSpan\&}{operator$-$}{\void} | |
311 | ||
312 | Negate the value of the timespan. | |
313 | ||
bd35ed32 VZ |
314 | |
315 | \membersection{wxTimeSpan::Milliseconds}\label{wxtimespanmilliseconds} | |
316 | ||
317 | \func{static wxTimespan}{Milliseconds}{\param{long }{ms}} | |
318 | ||
319 | Returns the timespan for the given number of milliseconds. | |
320 | ||
321 | ||
322 | \membersection{wxTimeSpan::Millisecond}\label{wxtimespanmillisecond} | |
323 | ||
324 | \func{static wxTimespan}{Millisecond}{\void} | |
325 | ||
326 | Returns the timespan for one millisecond. | |
327 | ||
328 | ||
22f22798 JS |
329 | \membersection{wxTimeSpan::Seconds}\label{wxtimespanseconds} |
330 | ||
331 | \func{static wxTimespan}{Seconds}{\param{long }{sec}} | |
332 | ||
333 | Returns the timespan for the given number of seconds. | |
334 | ||
bd35ed32 | 335 | |
22f22798 JS |
336 | \membersection{wxTimeSpan::Second}\label{wxtimespansecond} |
337 | ||
338 | \func{static wxTimespan}{Second}{\void} | |
339 | ||
340 | Returns the timespan for one second. | |
341 | ||
bd35ed32 | 342 | |
dbd94b75 | 343 | \membersection{wxTimeSpan::Subtract}\label{wxtimespansubtract} |
22f22798 | 344 | |
dbd94b75 | 345 | \constfunc{wxTimeSpan}{Subtract}{\param{const wxTimeSpan\&}{diff}} |
22f22798 | 346 | |
dbd94b75 | 347 | \func{wxTimeSpan\&}{Subtract}{\param{const wxTimeSpan\& }{diff}} |
22f22798 JS |
348 | |
349 | \func{wxTimeSpan\&}{operator$-=$}{\param{const wxTimeSpan\&}{diff}} | |
350 | ||
351 | Returns the difference of two timespans. | |
352 | ||
bd35ed32 | 353 | |
22f22798 JS |
354 | \membersection{wxTimeSpan::Weeks}\label{wxtimespanweeks} |
355 | ||
356 | \func{static wxTimespan}{Weeks}{\param{long }{weeks}} | |
357 | ||
358 | Returns the timespan for the given number of weeks. | |
359 | ||
bd35ed32 | 360 | |
22f22798 JS |
361 | \membersection{wxTimeSpan::Week}\label{wxtimespanweek} |
362 | ||
363 | \func{static wxTimespan}{Week}{\void} | |
364 | ||
365 | Returns the timespan for one week. | |
366 | ||
bd35ed32 | 367 | |
5283098e | 368 | \membersection{wxTimeSpan::wxTimeSpan}\label{wxtimespanctor} |
22f22798 JS |
369 | |
370 | \func{}{wxTimeSpan}{\void} | |
371 | ||
372 | Default constructor, constructs a zero timespan. | |
373 | ||
374 | \func{}{wxTimeSpan}{\param{long }{hours}, \param{long }{min}, \param{long }{sec}, \param{long }{msec}} | |
375 | ||
376 | Constructs timespan from separate values for each component, with the date | |
377 | set to 0. Hours are not restricted to 0..24 range, neither are | |
378 | minutes, seconds or milliseconds. | |
379 |