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