libcommonc++
0.7
|
A span of time (a delta), represented in milliseconds. More...
#include <TimeSpan.h++>
Public Member Functions | |
TimeSpan (int64_t span=INT64_CONST(0)) | |
Construct a TimeSpan for the given number of milliseconds. More... | |
TimeSpan (int days, int hours, int minutes, int seconds, int msec=0) | |
Construct a TimeSpan in terms of days, hours, minutes, seconds, and/or milliseconds. More... | |
TimeSpan (const TimeSpan &other) | |
Copy constructor. More... | |
~TimeSpan () | |
Destructor. More... | |
void | setSpan (int days, int hours, int minutes, int seconds, int msec=0) |
Set the timespan. More... | |
void | setSpan (int64_t seconds) |
Set the timespan in seconds. More... | |
int64_t | getSpan () const |
Get the timespan, in milliseconds. More... | |
void | setDays (int days) |
Set the days component of the timespan. More... | |
void | addDays (int days) |
Add days to the timespan. More... | |
void | subtractDays (int days) |
Subtract days from the timespan. More... | |
int | getDays () const |
Get the days component of the timespan. More... | |
void | setHours (int hours) |
Set the hours component of the timespan. More... | |
void | addHours (int hours) |
Add hours to the timespan. More... | |
void | subtractHours (int hours) |
Subtract hours from the timespan. More... | |
int | getHours () const |
Get the hours component of the timespan. More... | |
void | setMinutes (int minutes) |
Set the minutes component of the timespan. More... | |
void | addMinutes (int minutes) |
Add minutes to the timespan. More... | |
void | subtractMinutes (int minutes) |
Subtract minutes from the timespan. More... | |
int | getMinutes () const |
Get the minutes component of the timespan. More... | |
void | setSeconds (int seconds) |
Set the seconds component of the timespan. More... | |
void | addSeconds (int seconds) |
Add seconds to the timespan. More... | |
void | subtractSeconds (int seconds) |
Subtract seconds from the timespan. More... | |
int | getSeconds () const |
Get the seconds component of the timespan. More... | |
void | setMilliseconds (int msec) |
Set the milliseconds component of the timespan. More... | |
void | addMilliseconds (int msec) |
Add milliseconds to the timespan. More... | |
void | subtractMilliseconds (int msec) |
Subtract milliseconds from the timespan. More... | |
int | getMilliseconds () const |
Get the milliseconds component of the timespan. More... | |
TimeSpan & | operator= (const TimeSpan &other) |
bool | operator== (const TimeSpan &other) const |
bool | operator< (const TimeSpan &other) const |
bool | operator<= (const TimeSpan &other) const |
bool | operator!= (const TimeSpan &other) const |
bool | operator> (const TimeSpan &other) const |
bool | operator>= (const TimeSpan &other) const |
TimeSpan & | operator+= (const TimeSpan &span) |
TimeSpan & | operator+= (int seconds) |
TimeSpan & | operator-= (const TimeSpan &span) |
TimeSpan & | operator-= (int seconds) |
TimeSpan | operator- () const |
int64_t | toSeconds () const |
Get the timespan in seconds. More... | |
operator int64_t () const | |
Get the timespan in milliseconds. More... | |
int64_t | toMilliseconds () const |
Get the timespan in milliseconds. More... | |
String | toString () const |
Get a String representation of the TimeSpan. More... | |
Static Public Attributes | |
static const int | msInSecond = 1000 |
The number of milliseconds in a second. More... | |
static const int | msInMinute = 60000 |
The number of milliseconds in a minute. More... | |
static const int | msInHour = 3600000 |
The number of milliseconds in an hour. More... | |
static const int | msInDay = 86400000 |
The number of milliseconds in a day. More... | |
A span of time (a delta), represented in milliseconds.
TimeSpan | ( | int64_t | span = INT64_CONST(0) | ) |
Construct a TimeSpan for the given number of milliseconds.
span | The span, in milliseconds. |
TimeSpan | ( | int | days, |
int | hours, | ||
int | minutes, | ||
int | seconds, | ||
int | msec = 0 |
||
) |
Construct a TimeSpan in terms of days, hours, minutes, seconds, and/or milliseconds.
~TimeSpan | ( | ) |
Destructor.
void addDays | ( | int | days | ) |
Add days to the timespan.
void addHours | ( | int | hours | ) |
Add hours to the timespan.
void addMilliseconds | ( | int | msec | ) |
Add milliseconds to the timespan.
void addMinutes | ( | int | minutes | ) |
Add minutes to the timespan.
void addSeconds | ( | int | seconds | ) |
Add seconds to the timespan.
|
inline |
Get the days component of the timespan.
|
inline |
Get the hours component of the timespan.
|
inline |
Get the milliseconds component of the timespan.
|
inline |
Get the minutes component of the timespan.
|
inline |
Get the seconds component of the timespan.
|
inline |
Get the timespan, in milliseconds.
|
inline |
Get the timespan in milliseconds.
|
inline |
TimeSpan & operator+= | ( | int | seconds | ) |
TimeSpan operator- | ( | ) | const |
TimeSpan & operator-= | ( | int | seconds | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void setDays | ( | int | days | ) |
Set the days component of the timespan.
void setHours | ( | int | hours | ) |
Set the hours component of the timespan.
void setMilliseconds | ( | int | msec | ) |
Set the milliseconds component of the timespan.
void setMinutes | ( | int | minutes | ) |
Set the minutes component of the timespan.
void setSeconds | ( | int | seconds | ) |
Set the seconds component of the timespan.
void setSpan | ( | int | days, |
int | hours, | ||
int | minutes, | ||
int | seconds, | ||
int | msec = 0 |
||
) |
Set the timespan.
void setSpan | ( | int64_t | seconds | ) |
Set the timespan in seconds.
void subtractDays | ( | int | days | ) |
Subtract days from the timespan.
void subtractHours | ( | int | hours | ) |
Subtract hours from the timespan.
void subtractMilliseconds | ( | int | msec | ) |
Subtract milliseconds from the timespan.
void subtractMinutes | ( | int | minutes | ) |
Subtract minutes from the timespan.
void subtractSeconds | ( | int | seconds | ) |
Subtract seconds from the timespan.
|
inline |
Get the timespan in milliseconds.
|
inline |
Get the timespan in seconds.
|
static |
The number of milliseconds in a day.
|
static |
The number of milliseconds in an hour.
|
static |
The number of milliseconds in a minute.
|
static |
The number of milliseconds in a second.