Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

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 (long tv_sec, long tv_usec)
 Time (time_t time)
long sec () const
 Returns seconds value.

long usec () const
 Returns microseconds value.

void sec (long s)
 Sets the seconds value.

void usec (long us)
 Sets the microseconds value.

int setTime (struct tm *t)
 Sets this Time using the mktime function.

time_t getTime () const
 Returns this Time as a time_t> value.

void gmtime (struct tm *t) const
 Populates tm using the gmtime() function.

void localtime (struct 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)
bool operator== (const Time &rhs)
bool operator!= (const Time &rhs)

Static Public Member Functions

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 35 of file timehelper.h.


Constructor & Destructor Documentation

log4cplus::helpers::Time::Time  ) 
 

log4cplus::helpers::Time::Time long  tv_sec,
long  tv_usec
 

log4cplus::helpers::Time::Time time_t  time  ) 
 


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.

time_t log4cplus::helpers::Time::getTime  )  const
 

Returns this Time as a time_t> value.

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.)

void log4cplus::helpers::Time::gmtime struct tm *  t  )  const
 

Populates tm using the gmtime() function.

void log4cplus::helpers::Time::localtime struct tm *  t  )  const
 

Populates tm using the localtime() function.

Time& log4cplus::helpers::Time::operator *= long  rhs  ) 
 

bool log4cplus::helpers::Time::operator!= const Time rhs  )  [inline]
 

Definition at line 114 of file timehelper.h.

Time& log4cplus::helpers::Time::operator+= const Time rhs  ) 
 

Time& log4cplus::helpers::Time::operator-= const Time rhs  ) 
 

Time& log4cplus::helpers::Time::operator/= long  rhs  ) 
 

bool log4cplus::helpers::Time::operator== const Time rhs  )  [inline]
 

Definition at line 112 of file timehelper.h.

References tv_sec, and tv_usec.

void log4cplus::helpers::Time::sec long  s  )  [inline]
 

Sets the seconds value.

Definition at line 62 of file timehelper.h.

long log4cplus::helpers::Time::sec  )  const [inline]
 

Returns seconds value.

Definition at line 52 of file timehelper.h.

int log4cplus::helpers::Time::setTime struct tm *  t  ) 
 

Sets this Time using the mktime function.

void log4cplus::helpers::Time::usec long  us  )  [inline]
 

Sets the microseconds value.

Definition at line 67 of file timehelper.h.

long log4cplus::helpers::Time::usec  )  const [inline]
 

Returns microseconds value.

Definition at line 57 of file timehelper.h.


The documentation for this class was generated from the following file:
Generated on Mon Feb 9 09:10:45 2004 for log4cplus by doxygen 1.3.2