Bayonne2 / Common C++ 2 Framework
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Static Public Member Functions | Static Protected Member Functions | Static Private Attributes
SysTime Class Reference

This class is used to access non-reentrant date and time functions in the standard C library. More...

#include <thread.h>

Collaboration diagram for SysTime:
Collaboration graph
[legend]

Static Public Member Functions

static time_t getTime (time_t *tloc=NULL)
 
static time_t time (time_t *tloc)
 
static int getTimeOfDay (struct timeval *tp)
 
static int gettimeofday (struct timeval *tp, struct timezone *)
 
static struct tm * getLocalTime (const time_t *clock, struct tm *result)
 
static struct tm * locatime (const time_t *clock, struct tm *result)
 
static struct tm * getGMTTime (const time_t *clock, struct tm *result)
 
static struct tm * gmtime (const time_t *clock, struct tm *result)
 

Static Protected Member Functions

static void lock (void)
 
static void unlock (void)
 

Static Private Attributes

static Mutex timeLock
 

Detailed Description

This class is used to access non-reentrant date and time functions in the standard C library.

The class has two purposes:

Note
The class provides one function with the same name as its equivalent standard function and one with another, unique name. For new clients, the version with the unique name is recommended to make it easy to grep for accidental usage of the standard functions. The version with the standard name is provided for existing clients to sed replace their original version.
Also note that some functions that returned pointers have been redone to take that pointer as an argument instead, making the caller responsible for memory allocation/deallocation. This is almost how POSIX specifies *_r functions (reentrant versions of the standard time functions), except the POSIX functions also return the given pointer while we do not. We don't use the *_r functions as they aren't all generally available on all platforms yet.
Author
Idar Tollefsen idar@.nosp@m.cogn.nosp@m.ita.n.nosp@m.o Thread safe date and time functions.

Definition at line 1932 of file thread.h.

Member Function Documentation

static struct tm* SysTime::getGMTTime ( const time_t *  clock,
struct tm *  result 
)
static
static struct tm* SysTime::getLocalTime ( const time_t *  clock,
struct tm *  result 
)
static
static time_t SysTime::getTime ( time_t *  tloc = NULL)
static
static int SysTime::getTimeOfDay ( struct timeval *  tp)
static
static int SysTime::gettimeofday ( struct timeval *  tp,
struct timezone *   
)
inlinestatic

Definition at line 1950 of file thread.h.

static struct tm* SysTime::gmtime ( const time_t *  clock,
struct tm *  result 
)
inlinestatic

Definition at line 1958 of file thread.h.

static struct tm* SysTime::locatime ( const time_t *  clock,
struct tm *  result 
)
inlinestatic

Definition at line 1954 of file thread.h.

static void SysTime::lock ( void  )
inlinestaticprotected

Definition at line 1938 of file thread.h.

static time_t SysTime::time ( time_t *  tloc)
inlinestatic

Definition at line 1946 of file thread.h.

static void SysTime::unlock ( void  )
inlinestaticprotected

Definition at line 1941 of file thread.h.

Field Documentation

Mutex SysTime::timeLock
staticprivate

Definition at line 1935 of file thread.h.


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