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