log4cplus  1.1.0
Public Member Functions | Static Public Member Functions
log4cplus::helpers::Time Class Reference

This class represents a Epoch time with microsecond accuracy. More...

#include <timehelper.h>

List of all members.

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.
Timeoperator+= (const Time &rhs)
Timeoperator-= (const Time &rhs)
Timeoperator/= (long rhs)
Timeoperator*= (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.

Detailed Description

This class represents a Epoch time with microsecond accuracy.

Definition at line 54 of file timehelper.h.


Constructor & Destructor Documentation

log4cplus::helpers::Time::Time ( time_t  tv_sec,
long  tv_usec 
)
log4cplus::helpers::Time::Time ( time_t  time) [explicit]

Member Function Documentation

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.

Returns this Time as a time_t value.

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+= ( const Time rhs)
Time& log4cplus::helpers::Time::operator-= ( const Time 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.

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.


The documentation for this class was generated from the following file: