The SGTimeStamp class allows you to mark and compare time stamps with nanosecond accuracy (if your system has support for this level of accuracy). More...
#include <timestamp.hxx>
Public Member Functions | |
SGTimeStamp () | |
Default constructor, initialize time to zero. | |
void | stamp () |
Hmm, might reenable them at some time, but since it is not clear what the input unit of the int is, omit them for now. | |
void | setTime (const double &seconds) |
Set the time from a double value. | |
void | setTime (sec_type sec, nsec_type nsec) |
Set the time from a seconds/nanoseconds pair. | |
long | get_seconds () const |
int | get_usec () const |
const sec_type & | getSeconds () const |
const nsec_type & | getNanoSeconds () const |
double | toNSecs () const |
double | toUSecs () const |
double | toMSecs () const |
double | toSecs () const |
SGTimeStamp & | operator+= (const SGTimeStamp &c) |
Inplace addition. | |
SGTimeStamp & | operator-= (const SGTimeStamp &c) |
Inplace subtraction. | |
Static Public Member Functions | |
static SGTimeStamp | fromSecMSec (sec_type sec, nsec_type msec) |
Create SGTimeStamps from input with given units. | |
static SGTimeStamp | now () |
Return a timestamp with the current time. |
The SGTimeStamp class allows you to mark and compare time stamps with nanosecond accuracy (if your system has support for this level of accuracy).
The SGTimeStamp is useful for tracking the elapsed time of various events in your program. You can also use it to keep constistant motion across varying frame rates.
Note SGTimestamp does not deliver the time of day. The content of this stamps might be, dependent on the implementation, a time to an arbitrary base time.
Definition at line 55 of file timestamp.hxx.
SGTimeStamp::SGTimeStamp | ( | ) | [inline] |
Default constructor, initialize time to zero.
Definition at line 61 of file timestamp.hxx.
long SGTimeStamp::get_seconds | ( | ) | const [inline] |
Definition at line 103 of file timestamp.hxx.
int SGTimeStamp::get_usec | ( | ) | const [inline] |
Definition at line 106 of file timestamp.hxx.
const nsec_type& SGTimeStamp::getNanoSeconds | ( | ) | const [inline] |
Definition at line 112 of file timestamp.hxx.
const sec_type& SGTimeStamp::getSeconds | ( | ) | const [inline] |
Definition at line 109 of file timestamp.hxx.
void SGTimeStamp::stamp | ( | ) |
Hmm, might reenable them at some time, but since it is not clear what the input unit of the int is, omit them for now.
Use the static constructor functions where it is clear from the method name how the arguments are meant. Update stored time to current time (seconds and nanoseconds)
Definition at line 61 of file timestamp.cxx.
double SGTimeStamp::toMSecs | ( | ) | const [inline] |
Definition at line 136 of file timestamp.hxx.
double SGTimeStamp::toNSecs | ( | ) | const [inline] |
Definition at line 120 of file timestamp.hxx.
double SGTimeStamp::toSecs | ( | ) | const [inline] |
Definition at line 144 of file timestamp.hxx.
double SGTimeStamp::toUSecs | ( | ) | const [inline] |
Definition at line 128 of file timestamp.hxx.