]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/timespan.tex
remove duplicate m_popupInterface (patch 1509424)
[wxWidgets.git] / docs / latex / wx / timespan.tex
CommitLineData
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
14wxTimeSpan class represents a time interval.
15
16\wxheading{Derived from}
17
18No 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
bd35ed32 31
6d06e061 32\membersection{Static functions}\label{timespanstaticfunctions}
df05cdc5 33
bd35ed32
VZ
34\helpref{Milliseconds}{wxtimespanmilliseconds}\\
35\helpref{Millisecond}{wxtimespanmillisecond}\\
22f22798
JS
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
bd35ed32 47
6d06e061 48\membersection{Constructors}\label{timespanconstructors}
df05cdc5 49
5283098e 50\helpref{wxTimeSpan}{wxtimespanctor}
df05cdc5 51
bd35ed32 52
6d06e061 53\membersection{Accessors}\label{timespanaccessors}
df05cdc5 54
22f22798
JS
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
bd35ed32 62
6d06e061 63\membersection{Operations}\label{timespanoperations}
df05cdc5 64
22f22798 65\helpref{Add}{wxtimespanadd}\\
dbd94b75 66\helpref{Subtract}{wxtimespansubtract}\\
22f22798
JS
67\helpref{Multiply}{wxtimespanmultiply}\\
68\helpref{Negate}{wxtimespannegate}\\
69\helpref{Neg}{wxtimespanneg}\\
70\helpref{Abs}{wxtimespanabs}
71
bd35ed32 72
6d06e061 73\membersection{Tests}\label{timespantests}
df05cdc5 74
22f22798
JS
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
bd35ed32 82
6d06e061 83\membersection{Formatting time spans}\label{timespanformatting}
df05cdc5
VZ
84
85\helpref{Format}{wxtimespanformat}
86
87%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88% Start of member function part %
89%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
90
91\helponly{\insertatlevel{2}{
92 \wxheading{Members}
93}}
94
bd35ed32 95
22f22798
JS
96\membersection{wxTimeSpan::Abs}\label{wxtimespanabs}
97
98\constfunc{wxTimeSpan}{Abs}{\void}
99
100Returns the absolute value of the timespan: does not modify the
101object.
102
bd35ed32 103
22f22798
JS
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
112Returns the sum of two timespans.
113
bd35ed32 114
22f22798
JS
115\membersection{wxTimeSpan::Days}\label{wxtimespandays}
116
117\func{static wxTimespan}{Days}{\param{long }{days}}
118
119Returns the timespan for the given number of days.
120
bd35ed32 121
22f22798
JS
122\membersection{wxTimeSpan::Day}\label{wxtimespanday}
123
124\func{static wxTimespan}{Day}{\void}
125
126Returns the timespan for one day.
127
bd35ed32 128
df05cdc5
VZ
129\membersection{wxTimeSpan::Format}\label{wxtimespanformat}
130
1aaf88d2 131\func{wxString}{Format}{\param{const wxChar * }{format = wxDefaultTimeSpanFormat}}
df05cdc5
VZ
132
133Returns the string containing the formatted representation of the time span.
134The 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
147Note that, for example, the number of hours in the description above is not
148well defined: it can be either the total number of hours (for example, for a
149time span of $50$ hours this would be $50$) or just the hour part of the time
150span, which would be $2$ in this case as $50$ hours is equal to $2$ days and
151$2$ hours.
152
153wxTimeSpan resolves this ambiguity in the following way: if there had been,
154indeed, the {\tt \%D} format specified preceding the {\tt \%H}, then it is
155interpreted as $2$. Otherwise, it is $50$.
156
157The same applies to all other format specifiers: if they follow a specifier of
158larger unit, only the rest part is taken, otherwise the full value is used.
f6bcfd97 159
bd35ed32 160
22f22798
JS
161\membersection{wxTimeSpan::GetDays}\label{wxtimespangetdays}
162
163\constfunc{int}{GetDays}{\void}
164
165Returns the difference in number of days.
166
bd35ed32 167
22f22798
JS
168\membersection{wxTimeSpan::GetHours}\label{wxtimespangethours}
169
170\constfunc{int}{GetHours}{\void}
171
172Returns the difference in number of hours.
173
bd35ed32 174
22f22798
JS
175\membersection{wxTimeSpan::GetMilliseconds}\label{wxtimespangetmilliseconds}
176
177\constfunc{wxLongLong}{GetMilliseconds}{\void}
178
179Returns the difference in number of milliseconds.
180
bd35ed32 181
22f22798
JS
182\membersection{wxTimeSpan::GetMinutes}\label{wxtimespangetminutes}
183
184\constfunc{int}{GetMinutes}{\void}
185
186Returns the difference in number of minutes.
187
bd35ed32 188
22f22798
JS
189\membersection{wxTimeSpan::GetSeconds}\label{wxtimespangetseconds}
190
191\constfunc{wxLongLong}{GetSeconds}{\void}
192
193Returns the difference in number of seconds.
194
bd35ed32 195
22f22798
JS
196\membersection{wxTimeSpan::GetValue}\label{wxtimespangetvalue}
197
198\constfunc{wxLongLong}{GetValue}{\void}
199
200Returns the internal representation of timespan.
201
bd35ed32 202
22f22798
JS
203\membersection{wxTimeSpan::GetWeeks}\label{wxtimespangetweeks}
204
205\constfunc{int}{GetWeeks}{\void}
206
207Returns the difference in number of weeks.
208
bd35ed32 209
22f22798
JS
210\membersection{wxTimeSpan::Hours}\label{wxtimespanhours}
211
212\func{static wxTimespan}{Hours}{\param{long }{hours}}
213
214Returns the timespan for the given number of hours.
215
bd35ed32 216
22f22798
JS
217\membersection{wxTimeSpan::Hour}\label{wxtimespanhour}
218
219\func{static wxTimespan}{Hour}{\void}
220
221Returns the timespan for one hour.
222
bd35ed32 223
22f22798
JS
224\membersection{wxTimeSpan::IsEqualTo}\label{wxtimespanisequalto}
225
226\constfunc{bool}{IsEqualTo}{\param{const wxTimeSpan\& }{ts}}
227
cc81d32f 228Returns {\tt true} if two timespans are equal.
22f22798 229
bd35ed32 230
22f22798
JS
231\membersection{wxTimeSpan::IsLongerThan}\label{wxtimespanislongerthan}
232
233\constfunc{bool}{IsLongerThan}{\param{const wxTimeSpan\& }{ts}}
234
235Compares two timespans: works with the absolute values, i.e. -2
cc81d32f 236hours is longer than 1 hour. Also, it will return {\tt false} if
22f22798
JS
237the timespans are equal in absolute value.
238
bd35ed32 239
22f22798
JS
240\membersection{wxTimeSpan::IsNegative}\label{wxtimespanisnegative}
241
242\constfunc{bool}{IsNegative}{\void}
243
cc81d32f 244Returns {\tt true} if the timespan is negative.
22f22798 245
bd35ed32 246
22f22798
JS
247\membersection{wxTimeSpan::IsNull}\label{wxtimespanisnull}
248
249\constfunc{bool}{IsNull}{\void}
250
cc81d32f 251Returns {\tt true} if the timespan is empty.
22f22798 252
bd35ed32 253
22f22798
JS
254\membersection{wxTimeSpan::IsPositive}\label{wxtimespanispositive}
255
256\constfunc{bool}{IsPositive}{\void}
257
cc81d32f 258Returns {\tt true} if the timespan is positive.
22f22798 259
bd35ed32 260
22f22798
JS
261\membersection{wxTimeSpan::IsShorterThan}\label{wxtimespanisshorterthan}
262
263\constfunc{bool}{IsShorterThan}{\param{const wxTimeSpan\& }{ts}}
264
265Compares two timespans: works with the absolute values, i.e. 1
cc81d32f 266hour is shorter than -2 hours. Also, it will return {\tt false} if
22f22798
JS
267the timespans are equal in absolute value.
268
bd35ed32 269
22f22798
JS
270\membersection{wxTimeSpan::Minutes}\label{wxtimespanminutes}
271
272\func{static wxTimespan}{Minutes}{\param{long }{min}}
273
274Returns the timespan for the given number of minutes.
275
bd35ed32 276
22f22798
JS
277\membersection{wxTimeSpan::Minute}\label{wxtimespanminute}
278
279\func{static wxTimespan}{Minute}{\void}
280
281Returns the timespan for one minute.
282
bd35ed32 283
22f22798
JS
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
292Multiplies timespan by a scalar.
293
bd35ed32 294
22f22798
JS
295\membersection{wxTimeSpan::Negate}\label{wxtimespannegate}
296
297\constfunc{wxTimeSpan}{Negate}{\void}
298
dbd94b75 299Returns timespan with inverted sign.
22f22798 300
bd35ed32 301
22f22798
JS
302\membersection{wxTimeSpan::Neg}\label{wxtimespanneg}
303
304\func{wxTimeSpan\&}{Neg}{\void}
305
306\func{wxTimeSpan\&}{operator$-$}{\void}
307
308Negate the value of the timespan.
309
bd35ed32
VZ
310
311\membersection{wxTimeSpan::Milliseconds}\label{wxtimespanmilliseconds}
312
313\func{static wxTimespan}{Milliseconds}{\param{long }{ms}}
314
315Returns the timespan for the given number of milliseconds.
316
317
318\membersection{wxTimeSpan::Millisecond}\label{wxtimespanmillisecond}
319
320\func{static wxTimespan}{Millisecond}{\void}
321
322Returns the timespan for one millisecond.
323
324
22f22798
JS
325\membersection{wxTimeSpan::Seconds}\label{wxtimespanseconds}
326
327\func{static wxTimespan}{Seconds}{\param{long }{sec}}
328
329Returns the timespan for the given number of seconds.
330
bd35ed32 331
22f22798
JS
332\membersection{wxTimeSpan::Second}\label{wxtimespansecond}
333
334\func{static wxTimespan}{Second}{\void}
335
336Returns the timespan for one second.
337
bd35ed32 338
dbd94b75 339\membersection{wxTimeSpan::Subtract}\label{wxtimespansubtract}
22f22798 340
dbd94b75 341\constfunc{wxTimeSpan}{Subtract}{\param{const wxTimeSpan\&}{diff}}
22f22798 342
dbd94b75 343\func{wxTimeSpan\&}{Subtract}{\param{const wxTimeSpan\& }{diff}}
22f22798
JS
344
345\func{wxTimeSpan\&}{operator$-=$}{\param{const wxTimeSpan\&}{diff}}
346
347Returns the difference of two timespans.
348
bd35ed32 349
22f22798
JS
350\membersection{wxTimeSpan::Weeks}\label{wxtimespanweeks}
351
352\func{static wxTimespan}{Weeks}{\param{long }{weeks}}
353
354Returns the timespan for the given number of weeks.
355
bd35ed32 356
22f22798
JS
357\membersection{wxTimeSpan::Week}\label{wxtimespanweek}
358
359\func{static wxTimespan}{Week}{\void}
360
361Returns the timespan for one week.
362
bd35ed32 363
5283098e 364\membersection{wxTimeSpan::wxTimeSpan}\label{wxtimespanctor}
22f22798
JS
365
366\func{}{wxTimeSpan}{\void}
367
368Default constructor, constructs a zero timespan.
369
370\func{}{wxTimeSpan}{\param{long }{hours}, \param{long }{min}, \param{long }{sec}, \param{long }{msec}}
371
372Constructs timespan from separate values for each component, with the date
373set to 0. Hours are not restricted to 0..24 range, neither are
374minutes, seconds or milliseconds.
375