wxTimeSpan class represents a time interval.
Derived from
No base class
Include files
<wx/datetime.h>
See also
Date classes overview, wxDateTime
Seconds
Second
Minutes
Minute
Hours
Hour
Days
Day
Weeks
Week
GetSeconds
GetMinutes
GetHours
GetDays
GetWeeks
GetValue
Add
Subtract
Multiply
Negate
Neg
Abs
IsNull
IsPositive
IsNegative
IsEqualTo
IsLongerThan
IsShorterThan
Returns the absolute value of the timespan: does not modify the object.
wxTimeSpan Add(const wxTimeSpan& diff) const
Returns the sum of two timespans.
Returns the timespan for the given number of days.
Returns the timespan for one day.
Returns the string containing the formatted representation of the time span. The following format specifiers are allowed after %:
H | number of Hours |
---|---|
M | number of Minutes |
S | number of Seconds |
l | number of milliseconds |
D | number of Days |
E | number of wEeks |
% | the percent character |
Note that, for example, the number of hours in the description above is not
well defined: it can be either the total number of hours (for example, for a
time span of hours this would be
) or just the hour part of the time
span, which would be
in this case as
hours is equal to
days and
hours.
wxTimeSpan resolves this ambiguity in the following way: if there had been,
indeed, the %D format specified preceding the %H, then it is
interpreted as . Otherwise, it is
.
The same applies to all other format specifiers: if they follow a specifier of larger unit, only the rest part is taken, otherwise the full value is used.
Returns the difference in number of days.
Returns the difference in number of hours.
wxLongLong GetMilliseconds(void) const
Returns the difference in number of milliseconds.
Returns the difference in number of minutes.
wxLongLong GetSeconds(void) const
Returns the difference in number of seconds.
wxLongLong GetValue(void) const
Returns the internal representation of timespan.
Returns the difference in number of weeks.
Returns the timespan for the given number of hours.
Returns the timespan for one hour.
bool IsEqualTo(const wxTimeSpan& ts) const
Returns true if two timespans are equal.
bool IsLongerThan(const wxTimeSpan& ts) const
Compares two timespans: works with the absolute values, i.e. -2 hours is longer than 1 hour. Also, it will return false if the timespans are equal in absolute value.
Returns true if the timespan is negative.
Returns true if the timespan is empty.
Returns true if the timespan is positive.
bool IsShorterThan(const wxTimeSpan& ts) const
Compares two timespans: works with the absolute values, i.e. 1 hour is shorter than -2 hours. Also, it will return false if the timespans are equal in absolute value.
Returns the timespan for the given number of minutes.
Returns the timespan for one minute.
wxTimeSpan Multiply(int n) const
Multiplies timespan by a scalar.
Returns timespan with inverted sign.
Negate the value of the timespan.
Returns the timespan for the given number of seconds.
Returns the timespan for one second.
wxTimeSpan Subtract(const wxTimeSpan& diff) const
Returns the difference of two timespans.
Returns the timespan for the given number of weeks.
Returns the timespan for one week.
Default constructor, constructs a zero timespan.
Constructs timespan from separate values for each component, with the date set to 0. Hours are not restricted to 0..24 range, neither are minutes, seconds or milliseconds.
ymasuda 平成17年11月19日