FreeNOS
|
Provides an abstract interface to the system clock. More...
#include <SystemClock.h>
Public Types | |
enum | Result { Success, IOError } |
Result codes. More... | |
Public Member Functions | |
SystemClock () | |
Constructor. More... | |
void | value (struct timeval &val) const |
Get time value. More... | |
Result | now () |
Get the current time. More... | |
void | printDiff (const SystemClock &clock) const |
Print difference between two clocks to stdout. More... | |
void | printDiff (const struct timeval &stamp) const |
Print difference between to timestamps to stdout. More... | |
Private Attributes | |
struct timeval | m_timeval |
Time value. More... | |
Provides an abstract interface to the system clock.
Definition at line 34 of file SystemClock.h.
enum SystemClock::Result |
SystemClock::SystemClock | ( | ) |
Constructor.
Definition at line 23 of file SystemClock.cpp.
References m_timeval, timeval::tv_sec, and timeval::tv_usec.
SystemClock::Result SystemClock::now | ( | ) |
Get the current time.
Definition at line 35 of file SystemClock.cpp.
References gettimeofday(), IOError, m_timeval, and Success.
Referenced by MpiPrime::exec(), TimeCommand::execute(), and MpiPrime::searchParallel().
void SystemClock::printDiff | ( | const struct timeval & | stamp | ) | const |
Print difference between to timestamps to stdout.
stamp | Timestamp to compare with |
Definition at line 54 of file SystemClock.cpp.
References m_timeval, printf(), timeval::tv_sec, and timeval::tv_usec.
void SystemClock::printDiff | ( | const SystemClock & | clock | ) | const |
Print difference between two clocks to stdout.
clock | Clock to compare with |
Definition at line 49 of file SystemClock.cpp.
References m_timeval.
Referenced by MpiPrime::exec(), TimeCommand::execute(), and MpiPrime::searchParallel().
void SystemClock::value | ( | struct timeval & | val | ) | const |
Get time value.
val | Timeval struct |
Definition at line 29 of file SystemClock.cpp.
References m_timeval, timeval::tv_sec, and timeval::tv_usec.
|
private |
Time value.
Definition at line 85 of file SystemClock.h.
Referenced by now(), printDiff(), SystemClock(), and value().