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{wxBase
}{librarieslist
}
30 \helpref{Date classes overview
}{wxdatetimeoverview
},
\rtfsp
31 \helpref{wxDateTime
}{wxdatetime
}
33 \latexignore{\rtfignore{\wxheading{Function groups
}}}
36 \membersection{Static functions
}\label{timespanstaticfunctions
}
38 \helpref{Milliseconds
}{wxtimespanmilliseconds
}\\
39 \helpref{Millisecond
}{wxtimespanmillisecond
}\\
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
}
52 \membersection{Constructors
}\label{timespanconstructors
}
54 \helpref{wxTimeSpan
}{wxtimespanctor
}
57 \membersection{Accessors
}\label{timespanaccessors
}
59 \helpref{GetSeconds
}{wxtimespangetseconds
}\\
60 \helpref{GetMinutes
}{wxtimespangetminutes
}\\
61 \helpref{GetHours
}{wxtimespangethours
}\\
62 \helpref{GetDays
}{wxtimespangetdays
}\\
63 \helpref{GetWeeks
}{wxtimespangetweeks
}\\
64 \helpref{GetValue
}{wxtimespangetvalue
}
67 \membersection{Operations
}\label{timespanoperations
}
69 \helpref{Add
}{wxtimespanadd
}\\
70 \helpref{Subtract
}{wxtimespansubtract
}\\
71 \helpref{Multiply
}{wxtimespanmultiply
}\\
72 \helpref{Negate
}{wxtimespannegate
}\\
73 \helpref{Neg
}{wxtimespanneg
}\\
74 \helpref{Abs
}{wxtimespanabs
}
77 \membersection{Tests
}\label{timespantests
}
79 \helpref{IsNull
}{wxtimespanisnull
}\\
80 \helpref{IsPositive
}{wxtimespanispositive
}\\
81 \helpref{IsNegative
}{wxtimespanisnegative
}\\
82 \helpref{IsEqualTo
}{wxtimespanisequalto
}\\
83 \helpref{IsLongerThan
}{wxtimespanislongerthan
}\\
84 \helpref{IsShorterThan
}{wxtimespanisshorterthan
}
87 \membersection{Formatting time spans
}\label{timespanformatting
}
89 \helpref{Format
}{wxtimespanformat
}
91 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92 % Start of member function part %
93 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
95 \helponly{\insertatlevel{2}{
100 \membersection{wxTimeSpan::Abs
}\label{wxtimespanabs
}
102 \constfunc{wxTimeSpan
}{Abs
}{\void}
104 Returns the absolute value of the timespan: does not modify the
108 \membersection{wxTimeSpan::Add
}\label{wxtimespanadd
}
110 \constfunc{wxTimeSpan
}{Add
}{\param{const wxTimeSpan\&
}{diff
}}
112 \func{wxTimeSpan\&
}{Add
}{\param{const wxTimeSpan\&
}{diff
}}
114 \func{wxTimeSpan\&
}{operator$+=$
}{\param{const wxTimeSpan\&
}{diff
}}
116 Returns the sum of two timespans.
119 \membersection{wxTimeSpan::Days
}\label{wxtimespandays
}
121 \func{static wxTimespan
}{Days
}{\param{long
}{days
}}
123 Returns the timespan for the given number of days.
126 \membersection{wxTimeSpan::Day
}\label{wxtimespanday
}
128 \func{static wxTimespan
}{Day
}{\void}
130 Returns the timespan for one day.
133 \membersection{wxTimeSpan::Format
}\label{wxtimespanformat
}
135 \func{wxString
}{Format
}{\param{const wxChar *
}{format = wxDefaultTimeSpanFormat
}}
137 Returns the string containing the formatted representation of the time span.
138 The following format specifiers are allowed after \%:
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
}
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
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$.
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.
165 \membersection{wxTimeSpan::GetDays
}\label{wxtimespangetdays
}
167 \constfunc{int
}{GetDays
}{\void}
169 Returns the difference in number of days.
172 \membersection{wxTimeSpan::GetHours
}\label{wxtimespangethours
}
174 \constfunc{int
}{GetHours
}{\void}
176 Returns the difference in number of hours.
179 \membersection{wxTimeSpan::GetMilliseconds
}\label{wxtimespangetmilliseconds
}
181 \constfunc{wxLongLong
}{GetMilliseconds
}{\void}
183 Returns the difference in number of milliseconds.
186 \membersection{wxTimeSpan::GetMinutes
}\label{wxtimespangetminutes
}
188 \constfunc{int
}{GetMinutes
}{\void}
190 Returns the difference in number of minutes.
193 \membersection{wxTimeSpan::GetSeconds
}\label{wxtimespangetseconds
}
195 \constfunc{wxLongLong
}{GetSeconds
}{\void}
197 Returns the difference in number of seconds.
200 \membersection{wxTimeSpan::GetValue
}\label{wxtimespangetvalue
}
202 \constfunc{wxLongLong
}{GetValue
}{\void}
204 Returns the internal representation of timespan.
207 \membersection{wxTimeSpan::GetWeeks
}\label{wxtimespangetweeks
}
209 \constfunc{int
}{GetWeeks
}{\void}
211 Returns the difference in number of weeks.
214 \membersection{wxTimeSpan::Hours
}\label{wxtimespanhours
}
216 \func{static wxTimespan
}{Hours
}{\param{long
}{hours
}}
218 Returns the timespan for the given number of hours.
221 \membersection{wxTimeSpan::Hour
}\label{wxtimespanhour
}
223 \func{static wxTimespan
}{Hour
}{\void}
225 Returns the timespan for one hour.
228 \membersection{wxTimeSpan::IsEqualTo
}\label{wxtimespanisequalto
}
230 \constfunc{bool
}{IsEqualTo
}{\param{const wxTimeSpan\&
}{ts
}}
232 Returns
{\tt true
} if two timespans are equal.
235 \membersection{wxTimeSpan::IsLongerThan
}\label{wxtimespanislongerthan
}
237 \constfunc{bool
}{IsLongerThan
}{\param{const wxTimeSpan\&
}{ts
}}
239 Compares two timespans: works with the absolute values, i.e. -
2
240 hours is longer than
1 hour. Also, it will return
{\tt false
} if
241 the timespans are equal in absolute value.
244 \membersection{wxTimeSpan::IsNegative
}\label{wxtimespanisnegative
}
246 \constfunc{bool
}{IsNegative
}{\void}
248 Returns
{\tt true
} if the timespan is negative.
251 \membersection{wxTimeSpan::IsNull
}\label{wxtimespanisnull
}
253 \constfunc{bool
}{IsNull
}{\void}
255 Returns
{\tt true
} if the timespan is empty.
258 \membersection{wxTimeSpan::IsPositive
}\label{wxtimespanispositive
}
260 \constfunc{bool
}{IsPositive
}{\void}
262 Returns
{\tt true
} if the timespan is positive.
265 \membersection{wxTimeSpan::IsShorterThan
}\label{wxtimespanisshorterthan
}
267 \constfunc{bool
}{IsShorterThan
}{\param{const wxTimeSpan\&
}{ts
}}
269 Compares two timespans: works with the absolute values, i.e.
1
270 hour is shorter than -
2 hours. Also, it will return
{\tt false
} if
271 the timespans are equal in absolute value.
274 \membersection{wxTimeSpan::Minutes
}\label{wxtimespanminutes
}
276 \func{static wxTimespan
}{Minutes
}{\param{long
}{min
}}
278 Returns the timespan for the given number of minutes.
281 \membersection{wxTimeSpan::Minute
}\label{wxtimespanminute
}
283 \func{static wxTimespan
}{Minute
}{\void}
285 Returns the timespan for one minute.
288 \membersection{wxTimeSpan::Multiply
}\label{wxtimespanmultiply
}
290 \constfunc{wxTimeSpan
}{Multiply
}{\param{int
}{n
}}
292 \func{wxTimeSpan\&
}{Multiply
}{\param{int
}{n
}}
294 \func{wxTimeSpan\&
}{operator$*=$
}{\param{int
}{n
}}
296 Multiplies timespan by a scalar.
299 \membersection{wxTimeSpan::Negate
}\label{wxtimespannegate
}
301 \constfunc{wxTimeSpan
}{Negate
}{\void}
303 Returns timespan with inverted sign.
306 \membersection{wxTimeSpan::Neg
}\label{wxtimespanneg
}
308 \func{wxTimeSpan\&
}{Neg
}{\void}
310 \func{wxTimeSpan\&
}{operator$-$
}{\void}
312 Negate the value of the timespan.
315 \membersection{wxTimeSpan::Milliseconds
}\label{wxtimespanmilliseconds
}
317 \func{static wxTimespan
}{Milliseconds
}{\param{long
}{ms
}}
319 Returns the timespan for the given number of milliseconds.
322 \membersection{wxTimeSpan::Millisecond
}\label{wxtimespanmillisecond
}
324 \func{static wxTimespan
}{Millisecond
}{\void}
326 Returns the timespan for one millisecond.
329 \membersection{wxTimeSpan::Seconds
}\label{wxtimespanseconds
}
331 \func{static wxTimespan
}{Seconds
}{\param{long
}{sec
}}
333 Returns the timespan for the given number of seconds.
336 \membersection{wxTimeSpan::Second
}\label{wxtimespansecond
}
338 \func{static wxTimespan
}{Second
}{\void}
340 Returns the timespan for one second.
343 \membersection{wxTimeSpan::Subtract
}\label{wxtimespansubtract
}
345 \constfunc{wxTimeSpan
}{Subtract
}{\param{const wxTimeSpan\&
}{diff
}}
347 \func{wxTimeSpan\&
}{Subtract
}{\param{const wxTimeSpan\&
}{diff
}}
349 \func{wxTimeSpan\&
}{operator$-=$
}{\param{const wxTimeSpan\&
}{diff
}}
351 Returns the difference of two timespans.
354 \membersection{wxTimeSpan::Weeks
}\label{wxtimespanweeks
}
356 \func{static wxTimespan
}{Weeks
}{\param{long
}{weeks
}}
358 Returns the timespan for the given number of weeks.
361 \membersection{wxTimeSpan::Week
}\label{wxtimespanweek
}
363 \func{static wxTimespan
}{Week
}{\void}
365 Returns the timespan for one week.
368 \membersection{wxTimeSpan::wxTimeSpan
}\label{wxtimespanctor
}
370 \func{}{wxTimeSpan
}{\void}
372 Default constructor, constructs a zero timespan.
374 \func{}{wxTimeSpan
}{\param{long
}{hours
},
\param{long
}{min
},
\param{long
}{sec
},
\param{long
}{msec
}}
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.