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
}}}
31 \membersection{Static functions
}
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
}
44 \membersection{Constructors
}
46 \helpref{wxTimeSpan
}{wxtimespan
}
48 \membersection{Accessors
}
50 \helpref{GetSeconds
}{wxtimespangetseconds
}\\
51 \helpref{GetMinutes
}{wxtimespangetminutes
}\\
52 \helpref{GetHours
}{wxtimespangethours
}\\
53 \helpref{GetDays
}{wxtimespangetdays
}\\
54 \helpref{GetWeeks
}{wxtimespangetweeks
}\\
55 \helpref{GetValue
}{wxtimespangetvalue
}
57 \membersection{Operations
}
59 \helpref{Add
}{wxtimespanadd
}\\
60 \helpref{Substract
}{wxtimespansubstract
}\\
61 \helpref{Multiply
}{wxtimespanmultiply
}\\
62 \helpref{Negate
}{wxtimespannegate
}\\
63 \helpref{Neg
}{wxtimespanneg
}\\
64 \helpref{Abs
}{wxtimespanabs
}
68 \helpref{IsNull
}{wxtimespanisnull
}\\
69 \helpref{IsPositive
}{wxtimespanispositive
}\\
70 \helpref{IsNegative
}{wxtimespanisnegative
}\\
71 \helpref{IsEqualTo
}{wxtimespanisequalto
}\\
72 \helpref{IsLongerThan
}{wxtimespanislongerthan
}\\
73 \helpref{IsShorterThan
}{wxtimespanisshorterthan
}
75 \membersection{Formatting time spans
}
77 \helpref{Format
}{wxtimespanformat
}
79 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
80 % Start of member function part %
81 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
83 \helponly{\insertatlevel{2}{
87 \membersection{wxTimeSpan::Abs
}\label{wxtimespanabs
}
89 \constfunc{wxTimeSpan
}{Abs
}{\void}
91 Returns the absolute value of the timespan: does not modify the
94 \membersection{wxTimeSpan::Add
}\label{wxtimespanadd
}
96 \constfunc{wxTimeSpan
}{Add
}{\param{const wxTimeSpan\&
}{diff
}}
98 \func{wxTimeSpan\&
}{Add
}{\param{const wxTimeSpan\&
}{diff
}}
100 \func{wxTimeSpan\&
}{operator$+=$
}{\param{const wxTimeSpan\&
}{diff
}}
102 Returns the sum of two timespans.
104 \membersection{wxTimeSpan::Days
}\label{wxtimespandays
}
106 \func{static wxTimespan
}{Days
}{\param{long
}{days
}}
108 Returns the timespan for the given number of days.
110 \membersection{wxTimeSpan::Day
}\label{wxtimespanday
}
112 \func{static wxTimespan
}{Day
}{\void}
114 Returns the timespan for one day.
116 \membersection{wxTimeSpan::Format
}\label{wxtimespanformat
}
118 \func{wxString
}{Format
}{\param{const wxChar *
}{format = "\%H:\%M:\%S"
}}
120 Returns the string containing the formatted representation of the time span.
121 The following format specifiers are allowed after \%:
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
}
134 Note that, for example, the number of hours in the description above is not
135 well defined: it can be either the total number of hours (for example, for a
136 time span of $
50$ hours this would be $
50$) or just the hour part of the time
137 span, which would be $
2$ in this case as $
50$ hours is equal to $
2$ days and
140 wxTimeSpan resolves this ambiguity in the following way: if there had been,
141 indeed, the
{\tt \%D
} format specified preceding the
{\tt \%H
}, then it is
142 interpreted as $
2$. Otherwise, it is $
50$.
144 The same applies to all other format specifiers: if they follow a specifier of
145 larger unit, only the rest part is taken, otherwise the full value is used.
147 \membersection{wxTimeSpan::GetDays
}\label{wxtimespangetdays
}
149 \constfunc{int
}{GetDays
}{\void}
151 Returns the difference in number of days.
153 \membersection{wxTimeSpan::GetHours
}\label{wxtimespangethours
}
155 \constfunc{int
}{GetHours
}{\void}
157 Returns the difference in number of hours.
159 \membersection{wxTimeSpan::GetMilliseconds
}\label{wxtimespangetmilliseconds
}
161 \constfunc{wxLongLong
}{GetMilliseconds
}{\void}
163 Returns the difference in number of milliseconds.
165 \membersection{wxTimeSpan::GetMinutes
}\label{wxtimespangetminutes
}
167 \constfunc{int
}{GetMinutes
}{\void}
169 Returns the difference in number of minutes.
171 \membersection{wxTimeSpan::GetSeconds
}\label{wxtimespangetseconds
}
173 \constfunc{wxLongLong
}{GetSeconds
}{\void}
175 Returns the difference in number of seconds.
177 \membersection{wxTimeSpan::GetValue
}\label{wxtimespangetvalue
}
179 \constfunc{wxLongLong
}{GetValue
}{\void}
181 Returns the internal representation of timespan.
183 \membersection{wxTimeSpan::GetWeeks
}\label{wxtimespangetweeks
}
185 \constfunc{int
}{GetWeeks
}{\void}
187 Returns the difference in number of weeks.
189 \membersection{wxTimeSpan::Hours
}\label{wxtimespanhours
}
191 \func{static wxTimespan
}{Hours
}{\param{long
}{hours
}}
193 Returns the timespan for the given number of hours.
195 \membersection{wxTimeSpan::Hour
}\label{wxtimespanhour
}
197 \func{static wxTimespan
}{Hour
}{\void}
199 Returns the timespan for one hour.
201 \membersection{wxTimeSpan::IsEqualTo
}\label{wxtimespanisequalto
}
203 \constfunc{bool
}{IsEqualTo
}{\param{const wxTimeSpan\&
}{ts
}}
205 Returns
{\tt TRUE
} if two timespans are equal.
207 \membersection{wxTimeSpan::IsLongerThan
}\label{wxtimespanislongerthan
}
209 \constfunc{bool
}{IsLongerThan
}{\param{const wxTimeSpan\&
}{ts
}}
211 Compares two timespans: works with the absolute values, i.e. -
2
212 hours is longer than
1 hour. Also, it will return
{\tt FALSE
} if
213 the timespans are equal in absolute value.
215 \membersection{wxTimeSpan::IsNegative
}\label{wxtimespanisnegative
}
217 \constfunc{bool
}{IsNegative
}{\void}
219 Returns
{\tt TRUE
} if the timespan is negative.
221 \membersection{wxTimeSpan::IsNull
}\label{wxtimespanisnull
}
223 \constfunc{bool
}{IsNull
}{\void}
225 Returns
{\tt TRUE
} if the timespan is empty.
227 \membersection{wxTimeSpan::IsPositive
}\label{wxtimespanispositive
}
229 \constfunc{bool
}{IsPositive
}{\void}
231 Returns
{\tt TRUE
} if the timespan is positive.
233 \membersection{wxTimeSpan::IsShorterThan
}\label{wxtimespanisshorterthan
}
235 \constfunc{bool
}{IsShorterThan
}{\param{const wxTimeSpan\&
}{ts
}}
237 Compares two timespans: works with the absolute values, i.e.
1
238 hour is shorter than -
2 hours. Also, it will return
{\tt FALSE
} if
239 the timespans are equal in absolute value.
241 \membersection{wxTimeSpan::Minutes
}\label{wxtimespanminutes
}
243 \func{static wxTimespan
}{Minutes
}{\param{long
}{min
}}
245 Returns the timespan for the given number of minutes.
247 \membersection{wxTimeSpan::Minute
}\label{wxtimespanminute
}
249 \func{static wxTimespan
}{Minute
}{\void}
251 Returns the timespan for one minute.
253 \membersection{wxTimeSpan::Multiply
}\label{wxtimespanmultiply
}
255 \constfunc{wxTimeSpan
}{Multiply
}{\param{int
}{n
}}
257 \func{wxTimeSpan\&
}{Multiply
}{\param{int
}{n
}}
259 \func{wxTimeSpan\&
}{operator$*=$
}{\param{int
}{n
}}
261 Multiplies timespan by a scalar.
263 \membersection{wxTimeSpan::Negate
}\label{wxtimespannegate
}
265 \constfunc{wxTimeSpan
}{Negate
}{\void}
267 Returns timespan with inversed sign.
269 \membersection{wxTimeSpan::Neg
}\label{wxtimespanneg
}
271 \func{wxTimeSpan\&
}{Neg
}{\void}
273 \func{wxTimeSpan\&
}{operator$-$
}{\void}
275 Negate the value of the timespan.
277 \membersection{wxTimeSpan::Seconds
}\label{wxtimespanseconds
}
279 \func{static wxTimespan
}{Seconds
}{\param{long
}{sec
}}
281 Returns the timespan for the given number of seconds.
283 \membersection{wxTimeSpan::Second
}\label{wxtimespansecond
}
285 \func{static wxTimespan
}{Second
}{\void}
287 Returns the timespan for one second.
289 \membersection{wxTimeSpan::Substract
}\label{wxtimespansubstract
}
291 \constfunc{wxTimeSpan
}{Substract
}{\param{const wxTimeSpan\&
}{diff
}}
293 \func{wxTimeSpan\&
}{Substract
}{\param{const wxTimeSpan\&
}{diff
}}
295 \func{wxTimeSpan\&
}{operator$-=$
}{\param{const wxTimeSpan\&
}{diff
}}
297 Returns the difference of two timespans.
299 \membersection{wxTimeSpan::Weeks
}\label{wxtimespanweeks
}
301 \func{static wxTimespan
}{Weeks
}{\param{long
}{weeks
}}
303 Returns the timespan for the given number of weeks.
305 \membersection{wxTimeSpan::Week
}\label{wxtimespanweek
}
307 \func{static wxTimespan
}{Week
}{\void}
309 Returns the timespan for one week.
311 \membersection{wxTimeSpan::wxTimeSpan
}\label{wxtimespan
}
313 \func{}{wxTimeSpan
}{\void}
315 Default constructor, constructs a zero timespan.
317 \func{}{wxTimeSpan
}{\param{long
}{hours
},
\param{long
}{min
},
\param{long
}{sec
},
\param{long
}{msec
}}
319 Constructs timespan from separate values for each component, with the date
320 set to
0. Hours are not restricted to
0.
.24 range, neither are
321 minutes, seconds or milliseconds.