wxTimeSpan class represents a time interval.
Derived from
No base class
Include files
<wx/datetime.h>
See also
Date classes overview, wxDateTime
Function groups
Static functions
Constructors
Accessors
Operations
Tests
Formatting time spans
wxTimeSpan::Format
wxTimeSpan()
wxTimeSpan(hours, min, sec, msec)
wxString Format(const wxChar * format = "%H:%M:%S")
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 50 hours this would be 50) or just the hour part of the time span, which would be 2 in this case as 50 hours is equal to 2 days and 2 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 2. Otherwise, it is 50.
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.