![]() |
Scanframe Modular Application 0.1.0
|
Class wrapper for timespec structure to modify. More...
#include <TimeSpec.h>
Public Types | |
typedef long | nsec_type |
Integer type to indicate nanoseconds. | |
Public Member Functions | |
TimeSpec () | |
Default constructor. | |
TimeSpec (const TimeSpec &ts) | |
Copy constructor. | |
TimeSpec (TimeSpec &&ts)=default | |
Move constructor. | |
TimeSpec & | operator= (TimeSpec &&)=default |
Move assignment operator is default. | |
TimeSpec (const timespec &ts) | |
Parent copy constructor. | |
TimeSpec (double sec) | |
Initialize using seconds with a floating point. | |
TimeSpec (time_t sec, nsec_type nsec) | |
Initialize using seconds and nanoseconds. | |
TimeSpec & | operator= (const timespec &ts) |
Assignment operator using base structure. | |
bool | isZero () const |
Test if it has been set and thus not-zero. | |
operator bool () const | |
Test if it has been set and thus not-zero. | |
void | clear () |
clear this instance. | |
bool | operator>= (const timespec &ts) const |
Compare operator. | |
bool | operator> (const timespec &ts) const |
Compare operator. | |
bool | operator< (const timespec &ts) const |
Compare operator. | |
bool | operator<= (const timespec &ts) const |
Compare operator. | |
bool | operator== (const timespec &ts) const |
Compare operator. | |
bool | operator!= (const timespec &ts) const |
Compare operator. | |
TimeSpec & | operator= (const TimeSpec &ts) |
Assignment operator. | |
TimeSpec & | operator+= (nsec_type nsec) |
Operator to add nanoseconds. | |
TimeSpec & | operator-= (nsec_type nsec) |
Operator to add nanoseconds. | |
TimeSpec & | operator+= (const timespec &t) |
Operator to add another timespec. | |
TimeSpec & | operator-= (const timespec &t) |
Operator to subtract another timespec. | |
TimeSpec | operator+ (const timespec &t) const |
Operator to add another timespec. | |
TimeSpec | operator- (const timespec &t) const |
Operator to add another timespec. | |
TimeSpec & | assign (double sec) |
Assigns a double as seconds. | |
TimeSpec & | assign (const timespec &ts) |
Assigns a timespec base type. | |
TimeSpec & | randomize (double factor=0.1) |
Modifies the current value using the passed factor where 0.1 is + or - 10%. | |
TimeSpec & | setTimeOfDay () |
assign the current time. | |
TimeSpec & | add (time_t sec, nsec_type nsec) |
Adds seconds and nanoseconds to the current value. | |
TimeSpec & | add (const timespec &ts) |
Adds a timespec base type to the current value. | |
TimeSpec & | sub (const timespec &ts) |
Subtracts a timespec base type from the current value. | |
TimeSpec & | assign (time_t sec, nsec_type nsec) |
Assigns seconds and nanoseconds to the current value. | |
double | toDouble () const |
Gets the time value as a double. | |
time_t | toMilliSecs () const |
Gets the time value as a double. | |
std::string | toString () const |
Returns the time as toDouble() result converted to a string. | |
Class wrapper for timespec structure to modify.
typedef long sf::TimeSpec::nsec_type |
Integer type to indicate nanoseconds.
|
inline |
Default constructor.
|
inline |
Copy constructor.
|
default |
Move constructor.
|
inlineexplicit |
Parent copy constructor.
|
inlineexplicit |
Initialize using seconds with a floating point.
sec | Seconds. |
|
inlineexplicit |
Initialize using seconds and nanoseconds.
sec | Seconds. |
nsec | Nanoseconds. |
TimeSpec & sf::TimeSpec::add | ( | const timespec & | ts | ) |
Adds a timespec base type to the current value.
ts | Base class. |
Adds seconds and nanoseconds to the current value.
sec | Seconds. |
nsec | Nanoseconds. |
TimeSpec & sf::TimeSpec::assign | ( | const timespec & | ts | ) |
Assigns a timespec base type.
ts | Instance. |
TimeSpec & sf::TimeSpec::assign | ( | double | sec | ) |
Assigns a double as seconds.
sec | Seconds. |
Assigns seconds and nanoseconds to the current value.
sec | Seconds |
nsec | Nanosecond |
|
inline |
clear this instance.
|
inline |
Test if it has been set and thus not-zero.
|
inlineexplicit |
Test if it has been set and thus not-zero.
|
inline |
Compare operator.
|
inline |
Operator to add another timespec.
t | Time increment value. |
|
inline |
Operator to add another timespec.
t | Time increment value. |
Operator to add nanoseconds.
nsec | Nano seconds increment value. |
|
inline |
Operator to add another timespec.
t | Time decrement value. |
|
inline |
Operator to subtract another timespec.
t | Time decrement value. |
Operator to add nanoseconds.
nsec | Nano seconds decrement value. |
|
inline |
Compare operator.
|
inline |
Compare operator.
|
inline |
Assignment operator using base structure.
ts | Base structure. |
Assignment operator.
ts | Other instance. |
|
inline |
Compare operator.
|
inline |
Compare operator.
|
inline |
Compare operator.
TimeSpec & sf::TimeSpec::randomize | ( | double | factor = 0.1 | ) |
Modifies the current value using the passed factor where 0.1 is + or - 10%.
factor | For randomization where 1 = 100% |
TimeSpec & sf::TimeSpec::setTimeOfDay | ( | ) |
assign the current time.
TimeSpec & sf::TimeSpec::sub | ( | const timespec & | ts | ) |
Subtracts a timespec base type from the current value.
ts | Base class. |
double sf::TimeSpec::toDouble | ( | ) | const |
Gets the time value as a double.
time_t sf::TimeSpec::toMilliSecs | ( | ) | const |
Gets the time value as a double.
std::string sf::TimeSpec::toString | ( | ) | const |
Returns the time as toDouble() result converted to a string.