log4cplus
1.1.0
|
This class represents a Epoch time with microsecond accuracy. More...
#include <timehelper.h>
Public Member Functions | |
Time () | |
Time (time_t tv_sec, long tv_usec) | |
Time (time_t time) | |
time_t | sec () const |
Returns seconds value. | |
long | usec () const |
Returns microseconds value. | |
void | sec (time_t s) |
Sets the seconds value. | |
void | usec (long us) |
Sets the microseconds value. | |
time_t | setTime (tm *t) |
Sets this Time using the mktime function. | |
time_t | getTime () const LOG4CPLUS_ATTRIBUTE_PURE |
Returns this Time as a time_t value. | |
void | gmtime (tm *t) const |
Populates tm using the gmtime() function. | |
void | localtime (tm *t) const |
Populates tm using the localtime() function. | |
log4cplus::tstring | getFormattedTime (const log4cplus::tstring &fmt, bool use_gmtime=false) const |
Returns a string with a "formatted time" specified by fmt . | |
Time & | operator+= (const Time &rhs) |
Time & | operator-= (const Time &rhs) |
Time & | operator/= (long rhs) |
Time & | operator*= (long rhs) |
Static Public Member Functions | |
static Time | gettimeofday () |
Returns the current time using the gettimeofday() method if it is available on the current platform. |
This class represents a Epoch time with microsecond accuracy.
Definition at line 54 of file timehelper.h.
log4cplus::helpers::Time::Time | ( | time_t | tv_sec, |
long | tv_usec | ||
) |
log4cplus::helpers::Time::Time | ( | time_t | time | ) | [explicit] |
log4cplus::tstring log4cplus::helpers::Time::getFormattedTime | ( | const log4cplus::tstring & | fmt, |
bool | use_gmtime = false |
||
) | const |
Returns a string with a "formatted time" specified by fmt
.
It used the strftime()
function to do this.
Look at your platform's strftime()
documentation for the formatting options available.
The following additional options are provided:
q
- 3 character field that provides milliseconds Q
- 7 character field that provides fractional milliseconds.
time_t log4cplus::helpers::Time::getTime | ( | ) | const |
Returns this Time as a time_t
value.
static Time log4cplus::helpers::Time::gettimeofday | ( | ) | [static] |
Returns the current time using the gettimeofday()
method if it is available on the current platform.
(Not on WIN32.)
Referenced by log4cplus::thread::impl::ManualResetEvent::timed_wait().
void log4cplus::helpers::Time::gmtime | ( | tm * | t | ) | const |
Populates tm
using the gmtime()
function.
void log4cplus::helpers::Time::localtime | ( | tm * | t | ) | const |
Populates tm
using the localtime()
function.
Time& log4cplus::helpers::Time::operator*= | ( | long | rhs | ) |
Time& log4cplus::helpers::Time::operator/= | ( | long | rhs | ) |
time_t log4cplus::helpers::Time::sec | ( | ) | const [inline] |
Returns seconds value.
Definition at line 71 of file timehelper.h.
Referenced by log4cplus::thread::impl::ManualResetEvent::timed_wait().
void log4cplus::helpers::Time::sec | ( | time_t | s | ) | [inline] |
Sets the seconds value.
Definition at line 81 of file timehelper.h.
time_t log4cplus::helpers::Time::setTime | ( | tm * | t | ) |
Sets this Time using the mktime
function.
long log4cplus::helpers::Time::usec | ( | ) | const [inline] |
Returns microseconds value.
Definition at line 76 of file timehelper.h.
Referenced by log4cplus::thread::impl::ManualResetEvent::timed_wait().
void log4cplus::helpers::Time::usec | ( | long | us | ) | [inline] |
Sets the microseconds value.
Definition at line 86 of file timehelper.h.