This class represents a time span (using microseconds) More...
#include <mn_timespan.hpp>
Public Types | |
using | time_type = int64_t |
using | int_type = uint64_t |
using | self_type = basic_timespan |
Public Member Functions | |
basic_timespan () | |
Construct a new time span and initializes it to zero. More... | |
basic_timespan (time_type ms) | |
Construct a new time span and initializes it with the given value. More... | |
basic_timespan (struct timeval &val) | |
Construct a new time span and initializes it with the given timeval. More... | |
basic_timespan (uint16_t days, uint8_t hours, uint8_t minutes, uint8_t seconds, uint16_t microSeconds=0) | |
Construct a new time span and initializes it the given values. More... | |
basic_timespan (const self_type &other) | |
Construct a new time span from another time span. More... | |
uint16_t | get_days () const |
Get the number of days. More... | |
uint8_t | get_hours () const |
Get the number of (0 to 23) hours. More... | |
uint8_t | get_minutes () const |
Get the number of (0 to 59) minutes. More... | |
uint8_t | get_seconds () const |
Get the number of (0 to 59) seconds. More... | |
uint16_t | get_milliseconds () const |
Get the number of milliseconds. More... | |
int_type | get_microseconds () const |
Get the number of microseconds. More... | |
int_type | get_total_hours () const |
Get the total number of hours. More... | |
int_type | get_total_minutes () const |
Get the total number of minutes. More... | |
int_type | get_total_seconds () const |
Get the total number of seconds. More... | |
int_type | get_total_milliseconds () const |
Get the total number of milliseconds. More... | |
int_type | get_total_microseconds () const |
Get the total number of microseconds. More... | |
self_type & | operator= (const self_type ×pan) |
self_type & | operator= (time_type microseconds) |
self_type & | operator= (struct timeval val) |
bool | operator== (const self_type &ts) const |
bool | operator== (time_type microSeconds) const |
bool | operator!= (const self_type &ts) const |
bool | operator!= (time_type microSeconds) const |
bool | operator> (const self_type &ts) const |
bool | operator> (time_type microSeconds) const |
bool | operator>= (const self_type &ts) const |
bool | operator>= (time_type microSeconds) const |
bool | operator< (const self_type &ts) const |
bool | operator< (time_type microSeconds) const |
bool | operator<= (const self_type &ts) const |
bool | operator<= (time_type microSeconds) const |
self_type & | operator+= (const self_type &other) |
self_type & | operator+= (time_type ms) |
self_type & | operator-= (const self_type &other) |
self_type & | operator-= (time_type ms) |
self_type | operator+ (const self_type &other) const |
self_type | operator- (const self_type &other) const |
self_type | operator+ (time_type ms) const |
self_type | operator- (time_type ms) const |
void | swap (self_type &other) |
Swap this time span with a other time span. More... | |
self_type & | assign (uint16_t days, uint8_t hours, uint8_t minutes, uint8_t seconds, uint16_t microSeconds) |
Assigns a new time span. More... | |
self_type & | assign (struct timeval val) |
Assigns a new time span. More... | |
time_type | to_ticks () const |
Static Public Member Functions | |
static basic_timespan | now () |
Get the current time. More... | |
static basic_timespan | from_ticks (const unsigned int &ticks) |
Private Attributes | |
time_type | m_timeSpan |
Detailed Description
This class represents a time span (using microseconds)
Member Typedef Documentation
◆ int_type
using mn::basic_timespan::int_type = uint64_t |
◆ self_type
◆ time_type
using mn::basic_timespan::time_type = int64_t |
Constructor & Destructor Documentation
◆ basic_timespan() [1/5]
mn::basic_timespan::basic_timespan | ( | ) |
Construct a new time span and initializes it to zero.
◆ basic_timespan() [2/5]
mn::basic_timespan::basic_timespan | ( | time_type | ms | ) |
Construct a new time span and initializes it with the given value.
◆ basic_timespan() [3/5]
mn::basic_timespan::basic_timespan | ( | struct timeval & | val | ) |
Construct a new time span and initializes it with the given timeval.
◆ basic_timespan() [4/5]
mn::basic_timespan::basic_timespan | ( | uint16_t | days, |
uint8_t | hours, | ||
uint8_t | minutes, | ||
uint8_t | seconds, | ||
uint16_t | microSeconds = 0 |
||
) |
Construct a new time span and initializes it the given values.
◆ basic_timespan() [5/5]
mn::basic_timespan::basic_timespan | ( | const self_type & | other | ) |
Construct a new time span from another time span.
Member Function Documentation
◆ assign() [1/2]
basic_timespan & mn::basic_timespan::assign | ( | struct timeval | val | ) |
Assigns a new time span.
◆ assign() [2/2]
basic_timespan & mn::basic_timespan::assign | ( | uint16_t | days, |
uint8_t | hours, | ||
uint8_t | minutes, | ||
uint8_t | seconds, | ||
uint16_t | microSeconds | ||
) |
Assigns a new time span.
◆ from_ticks()
|
static |
◆ get_days()
uint16_t mn::basic_timespan::get_days | ( | ) | const |
Get the number of days.
◆ get_hours()
uint8_t mn::basic_timespan::get_hours | ( | ) | const |
Get the number of (0 to 23) hours.
◆ get_microseconds()
basic_timespan::int_type mn::basic_timespan::get_microseconds | ( | ) | const |
Get the number of microseconds.
◆ get_milliseconds()
uint16_t mn::basic_timespan::get_milliseconds | ( | ) | const |
Get the number of milliseconds.
◆ get_minutes()
uint8_t mn::basic_timespan::get_minutes | ( | ) | const |
Get the number of (0 to 59) minutes.
◆ get_seconds()
uint8_t mn::basic_timespan::get_seconds | ( | ) | const |
Get the number of (0 to 59) seconds.
◆ get_total_hours()
basic_timespan::int_type mn::basic_timespan::get_total_hours | ( | ) | const |
Get the total number of hours.
◆ get_total_microseconds()
basic_timespan::int_type mn::basic_timespan::get_total_microseconds | ( | ) | const |
Get the total number of microseconds.
◆ get_total_milliseconds()
basic_timespan::int_type mn::basic_timespan::get_total_milliseconds | ( | ) | const |
Get the total number of milliseconds.
◆ get_total_minutes()
basic_timespan::int_type mn::basic_timespan::get_total_minutes | ( | ) | const |
Get the total number of minutes.
◆ get_total_seconds()
basic_timespan::int_type mn::basic_timespan::get_total_seconds | ( | ) | const |
Get the total number of seconds.
◆ now()
|
static |
Get the current time.
- Returns
- The current time.
◆ operator!=() [1/2]
|
inline |
◆ operator!=() [2/2]
|
inline |
◆ operator+() [1/2]
◆ operator+() [2/2]
◆ operator+=() [1/2]
◆ operator+=() [2/2]
◆ operator-() [1/2]
◆ operator-() [2/2]
◆ operator-=() [1/2]
◆ operator-=() [2/2]
◆ operator<() [1/2]
|
inline |
◆ operator<() [2/2]
|
inline |
◆ operator<=() [1/2]
|
inline |
◆ operator<=() [2/2]
|
inline |
◆ operator=() [1/3]
basic_timespan & mn::basic_timespan::operator= | ( | const self_type & | timespan | ) |
◆ operator=() [2/3]
basic_timespan & mn::basic_timespan::operator= | ( | struct timeval | val | ) |
◆ operator=() [3/3]
basic_timespan & mn::basic_timespan::operator= | ( | time_type | microseconds | ) |
◆ operator==() [1/2]
|
inline |
◆ operator==() [2/2]
|
inline |
◆ operator>() [1/2]
|
inline |
◆ operator>() [2/2]
|
inline |
◆ operator>=() [1/2]
|
inline |
◆ operator>=() [2/2]
|
inline |
◆ swap()
|
inline |
Swap this time span with a other time span.
◆ to_ticks()
basic_timespan::time_type mn::basic_timespan::to_ticks | ( | ) | const |
Member Data Documentation
◆ m_timeSpan
|
private |
The documentation for this class was generated from the following files: