1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxDateSpan documentation
4 %% Author: Vadim Zeitlin
8 %% Copyright: (c) Vadim Zeitlin
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxTimeSpan
}}\label{wxtimespan
}
14 wxTimeSpan class represents a time interval.
16 \wxheading{Derived from
}
20 \wxheading{Include files
}
26 \helpref{Date classes overview
}{wxdatetimeoverview
},
\rtfsp
27 \helpref{wxDateTime
}{wxdatetime
}
29 \latexignore{\rtfignore{\wxheading{Function groups
}}}
32 \membersection{Static functions
}\label{timespanstaticfunctions
}
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
}
48 \membersection{Constructors
}\label{timespanconstructors
}
50 \helpref{wxTimeSpan
}{wxtimespanctor
}
53 \membersection{Accessors
}\label{timespanaccessors
}
55 \helpref{GetSeconds
}{wxtimespangetseconds
}\\
56 \helpref{GetMinutes
}{wxtimespangetminutes
}\\
57 \helpref{GetHours
}{wxtimespangethours
}\\
58 \helpref{GetDays
}{wxtimespangetdays
}\\
59 \helpref{GetWeeks
}{wxtimespangetweeks
}\\
60 \helpref{GetValue
}{wxtimespangetvalue
}
63 \membersection{Operations
}\label{timespanoperations
}
65 \helpref{Add
}{wxtimespanadd
}\\
66 \helpref{Subtract
}{wxtimespansubtract
}\\
67 \helpref{Multiply
}{wxtimespanmultiply
}\\
68 \helpref{Negate
}{wxtimespannegate
}\\
69 \helpref{Neg
}{wxtimespanneg
}\\
70 \helpref{Abs
}{wxtimespanabs
}
73 \membersection{Tests
}\label{timespantests
}
75 \helpref{IsNull
}{wxtimespanisnull
}\\
76 \helpref{IsPositive
}{wxtimespanispositive
}\\
77 \helpref{IsNegative
}{wxtimespanisnegative
}\\
78 \helpref{IsEqualTo
}{wxtimespanisequalto
}\\
79 \helpref{IsLongerThan
}{wxtimespanislongerthan
}\\
80 \helpref{IsShorterThan
}{wxtimespanisshorterthan
}
83 \membersection{Formatting time spans
}\label{timespanformatting
}
85 \helpref{Format
}{wxtimespanformat
}
87 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88 % Start of member function part %
89 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
91 \helponly{\insertatlevel{2}{
96 \membersection{wxTimeSpan::Abs
}\label{wxtimespanabs
}
98 \constfunc{wxTimeSpan
}{Abs
}{\void}
100 Returns the absolute value of the timespan: does not modify the
104 \membersection{wxTimeSpan::Add
}\label{wxtimespanadd
}
106 \constfunc{wxTimeSpan
}{Add
}{\param{const wxTimeSpan\&
}{diff
}}
108 \func{wxTimeSpan\&
}{Add
}{\param{const wxTimeSpan\&
}{diff
}}
110 \func{wxTimeSpan\&
}{operator$+=$
}{\param{const wxTimeSpan\&
}{diff
}}
112 Returns the sum of two timespans.
115 \membersection{wxTimeSpan::Days
}\label{wxtimespandays
}
117 \func{static wxTimespan
}{Days
}{\param{long
}{days
}}
119 Returns the timespan for the given number of days.
122 \membersection{wxTimeSpan::Day
}\label{wxtimespanday
}
124 \func{static wxTimespan
}{Day
}{\void}
126 Returns the timespan for one day.
129 \membersection{wxTimeSpan::Format
}\label{wxtimespanformat
}
131 \func{wxString
}{Format
}{\param{const wxChar *
}{format = wxDefaultTimeSpanFormat
}}
133 Returns the string containing the formatted representation of the time span.
134 The following format specifiers are allowed after \%:
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
}
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
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$.
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.
161 \membersection{wxTimeSpan::GetDays
}\label{wxtimespangetdays
}
163 \constfunc{int
}{GetDays
}{\void}
165 Returns the difference in number of days.
168 \membersection{wxTimeSpan::GetHours
}\label{wxtimespangethours
}
170 \constfunc{int
}{GetHours
}{\void}
172 Returns the difference in number of hours.
175 \membersection{wxTimeSpan::GetMilliseconds
}\label{wxtimespangetmilliseconds
}
177 \constfunc{wxLongLong
}{GetMilliseconds
}{\void}
179 Returns the difference in number of milliseconds.
182 \membersection{wxTimeSpan::GetMinutes
}\label{wxtimespangetminutes
}
184 \constfunc{int
}{GetMinutes
}{\void}
186 Returns the difference in number of minutes.
189 \membersection{wxTimeSpan::GetSeconds
}\label{wxtimespangetseconds
}
191 \constfunc{wxLongLong
}{GetSeconds
}{\void}
193 Returns the difference in number of seconds.
196 \membersection{wxTimeSpan::GetValue
}\label{wxtimespangetvalue
}
198 \constfunc{wxLongLong
}{GetValue
}{\void}
200 Returns the internal representation of timespan.
203 \membersection{wxTimeSpan::GetWeeks
}\label{wxtimespangetweeks
}
205 \constfunc{int
}{GetWeeks
}{\void}
207 Returns the difference in number of weeks.
210 \membersection{wxTimeSpan::Hours
}\label{wxtimespanhours
}
212 \func{static wxTimespan
}{Hours
}{\param{long
}{hours
}}
214 Returns the timespan for the given number of hours.
217 \membersection{wxTimeSpan::Hour
}\label{wxtimespanhour
}
219 \func{static wxTimespan
}{Hour
}{\void}
221 Returns the timespan for one hour.
224 \membersection{wxTimeSpan::IsEqualTo
}\label{wxtimespanisequalto
}
226 \constfunc{bool
}{IsEqualTo
}{\param{const wxTimeSpan\&
}{ts
}}
228 Returns
{\tt true
} if two timespans are equal.
231 \membersection{wxTimeSpan::IsLongerThan
}\label{wxtimespanislongerthan
}
233 \constfunc{bool
}{IsLongerThan
}{\param{const wxTimeSpan\&
}{ts
}}
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.
240 \membersection{wxTimeSpan::IsNegative
}\label{wxtimespanisnegative
}
242 \constfunc{bool
}{IsNegative
}{\void}
244 Returns
{\tt true
} if the timespan is negative.
247 \membersection{wxTimeSpan::IsNull
}\label{wxtimespanisnull
}
249 \constfunc{bool
}{IsNull
}{\void}
251 Returns
{\tt true
} if the timespan is empty.
254 \membersection{wxTimeSpan::IsPositive
}\label{wxtimespanispositive
}
256 \constfunc{bool
}{IsPositive
}{\void}
258 Returns
{\tt true
} if the timespan is positive.
261 \membersection{wxTimeSpan::IsShorterThan
}\label{wxtimespanisshorterthan
}
263 \constfunc{bool
}{IsShorterThan
}{\param{const wxTimeSpan\&
}{ts
}}
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.
270 \membersection{wxTimeSpan::Minutes
}\label{wxtimespanminutes
}
272 \func{static wxTimespan
}{Minutes
}{\param{long
}{min
}}
274 Returns the timespan for the given number of minutes.
277 \membersection{wxTimeSpan::Minute
}\label{wxtimespanminute
}
279 \func{static wxTimespan
}{Minute
}{\void}
281 Returns the timespan for one minute.
284 \membersection{wxTimeSpan::Multiply
}\label{wxtimespanmultiply
}
286 \constfunc{wxTimeSpan
}{Multiply
}{\param{int
}{n
}}
288 \func{wxTimeSpan\&
}{Multiply
}{\param{int
}{n
}}
290 \func{wxTimeSpan\&
}{operator$*=$
}{\param{int
}{n
}}
292 Multiplies timespan by a scalar.
295 \membersection{wxTimeSpan::Negate
}\label{wxtimespannegate
}
297 \constfunc{wxTimeSpan
}{Negate
}{\void}
299 Returns timespan with inverted sign.
302 \membersection{wxTimeSpan::Neg
}\label{wxtimespanneg
}
304 \func{wxTimeSpan\&
}{Neg
}{\void}
306 \func{wxTimeSpan\&
}{operator$-$
}{\void}
308 Negate the value of the timespan.
311 \membersection{wxTimeSpan::Milliseconds
}\label{wxtimespanmilliseconds
}
313 \func{static wxTimespan
}{Milliseconds
}{\param{long
}{ms
}}
315 Returns the timespan for the given number of milliseconds.
318 \membersection{wxTimeSpan::Millisecond
}\label{wxtimespanmillisecond
}
320 \func{static wxTimespan
}{Millisecond
}{\void}
322 Returns the timespan for one millisecond.
325 \membersection{wxTimeSpan::Seconds
}\label{wxtimespanseconds
}
327 \func{static wxTimespan
}{Seconds
}{\param{long
}{sec
}}
329 Returns the timespan for the given number of seconds.
332 \membersection{wxTimeSpan::Second
}\label{wxtimespansecond
}
334 \func{static wxTimespan
}{Second
}{\void}
336 Returns the timespan for one second.
339 \membersection{wxTimeSpan::Subtract
}\label{wxtimespansubtract
}
341 \constfunc{wxTimeSpan
}{Subtract
}{\param{const wxTimeSpan\&
}{diff
}}
343 \func{wxTimeSpan\&
}{Subtract
}{\param{const wxTimeSpan\&
}{diff
}}
345 \func{wxTimeSpan\&
}{operator$-=$
}{\param{const wxTimeSpan\&
}{diff
}}
347 Returns the difference of two timespans.
350 \membersection{wxTimeSpan::Weeks
}\label{wxtimespanweeks
}
352 \func{static wxTimespan
}{Weeks
}{\param{long
}{weeks
}}
354 Returns the timespan for the given number of weeks.
357 \membersection{wxTimeSpan::Week
}\label{wxtimespanweek
}
359 \func{static wxTimespan
}{Week
}{\void}
361 Returns the timespan for one week.
364 \membersection{wxTimeSpan::wxTimeSpan
}\label{wxtimespanctor
}
366 \func{}{wxTimeSpan
}{\void}
368 Default constructor, constructs a zero timespan.
370 \func{}{wxTimeSpan
}{\param{long
}{hours
},
\param{long
}{min
},
\param{long
}{sec
},
\param{long
}{msec
}}
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.