Poster of Linux kernelThe best gift for a Linux geek
ost::SysTime

ost::SysTime

Section: C Library Functions (3) Updated: 16 Feb 2010
Local index Up
 

NAME

ost::SysTime -

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

 

SYNOPSIS


#include <thread.h>  

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)
 

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.no> Thread safe date and time functions.

 

Member Function Documentation

 

static struct tm* ost::SysTime::getGMTTime (const time_t * clock, struct tm * result) [static, read]

 

static struct tm* ost::SysTime::getLocalTime (const time_t * clock, struct tm * result) [static, read]

 

static time_t ost::SysTime::getTime (time_t * tloc = NULL) [static]

 

static int ost::SysTime::gettimeofday (struct timeval * tp, struct timezone *) [inline, static]

 

static int ost::SysTime::getTimeOfDay (struct timeval * tp) [static]

 

static struct tm* ost::SysTime::gmtime (const time_t * clock, struct tm * result) [inline, static, read]

 

static struct tm* ost::SysTime::locatime (const time_t * clock, struct tm * result) [inline, static, read]

 

static void ost::SysTime::lock (void) [inline, static, protected]

 

static time_t ost::SysTime::time (time_t * tloc) [inline, static]

 

static void ost::SysTime::unlock (void) [inline, static, protected]

 

Author

Generated automatically by Doxygen for GNU CommonC++ from the source code.


 

Index

NAME
SYNOPSIS
Static Public Member Functions
Static Protected Member Functions
Detailed Description
Member Function Documentation
static struct tm* ost::SysTime::getGMTTime (const time_t * clock, struct tm * result) [static, read]
static struct tm* ost::SysTime::getLocalTime (const time_t * clock, struct tm * result) [static, read]
static time_t ost::SysTime::getTime (time_t * tloc = NULL) [static]
static int ost::SysTime::gettimeofday (struct timeval * tp, struct timezone *) [inline, static]
static int ost::SysTime::getTimeOfDay (struct timeval * tp) [static]
static struct tm* ost::SysTime::gmtime (const time_t * clock, struct tm * result) [inline, static, read]
static struct tm* ost::SysTime::locatime (const time_t * clock, struct tm * result) [inline, static, read]
static void ost::SysTime::lock (void) [inline, static, protected]
static time_t ost::SysTime::time (time_t * tloc) [inline, static]
static void ost::SysTime::unlock (void) [inline, static, protected]
Author

This document was created by man2html, using the manual pages.
Time: 21:51:52 GMT, April 16, 2011