ost::SysTime - This class is used to access non-reentrant date and time functions in the standard C
Contents
Detailed Description
This class is used to access non-reentrant date and time functions in the standard C library.
The class has two purposes:
• 1 To be used internaly in CommonCpp's date and time classes to make them thread safe.
• 2 To be used by clients as thread safe replacements to the standard C functions, much like
Thread::sleep() represents a thread safe version of the standard sleep() function.
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@cognita.noThread safe date and time functions.
Member Function Documentation
staticstructtm*ost::SysTime::getGMTTime(consttime_t*clock,structtm*result)[static]
Referenced by ost::gmtime_r().
staticstructtm*ost::SysTime::getLocalTime(consttime_t*clock,structtm*result)[static]
Referenced by ost::localtime_r().
statictime_tost::SysTime::getTime(time_t*tloc=NULL)[static]staticintost::SysTime::getTimeOfDay(structtimeval*tp)[static]staticintost::SysTime::gettimeofday(structtimeval*tp,structtimezone*)[inline],[static]staticstructtm*ost::SysTime::gmtime(consttime_t*clock,structtm*result)[inline],[static]staticstructtm*ost::SysTime::locatime(consttime_t*clock,structtm*result)[inline],[static]staticvoidost::SysTime::lock(void)[inline],[static],[protected]
References ost::Mutex::enterMutex().
statictime_tost::SysTime::time(time_t*tloc)[inline],[static]staticvoidost::SysTime::unlock(void)[inline],[static],[protected]
References ost::Mutex::leaveMutex().
Name
ost::SysTime - This class is used to access non-reentrant date and time functions in the standard C
library.
Synopsis
#include <thread.h>
StaticPublicMemberFunctions
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)
StaticProtectedMemberFunctions
static void lock (void)
static void unlock (void)
