sipxportlib  Version 3.3
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
OsDateTimeBase Class Referenceabstract

#include <OsDateTime.h>

Inheritance diagram for OsDateTimeBase:
Inheritance graph
[legend]

Public Types

enum  DstRule { DST_NONE, DST_NORTH_AMERICA, DST_WESTERN_EUROPE }
 

Public Member Functions

virtual OsStatus cvtToTimeSinceBoot (OsTime &rTime) const =0
 param: (in) tzOffsetSecs - local time offset (seconds relative to GMT) param: (in) dstRule - daylight savings time rule More...
 
virtual OsStatus cvtToTimeSinceEpoch (OsTime &rTime) const
 
void getDayOfWeek (int &dayOfWeek)
 param: (in) year - 4 digit year param: (in) month - 0-11 param: (in) dayOfMonth - the day of the month 1-31 param: (out) dayOfWeek - the day of the week 0-6 More...
 
unsigned int getMicrosecond () const
 param: (out) dayOfWeek - the day of the week 0-6 More...
 
unsigned short getYear () const
 
unsigned char getMonth () const
 
unsigned char getDay () const
 
unsigned char getHour () const
 
unsigned char getMinute () const
 
unsigned char getSecond () const
 
virtual void getHttpTimeString (UtlString &dataString)
 
void getSqlTimeStringZ (UtlString &dateString)
 Set the dateString to the time as UTC time in a Postgres compatible format: 2002-08-26 19:21:32.000. More...
 
void getIsoTimeStringZ (UtlString &dateString)
 Set the dateString to the time as UTC time in the following format: 2002-08-26T19:21:32.000Z. More...
 
void getIsoTimeStringZus (UtlString &dateString)
 Set the dateString to the time as UTC time in the following format: 2002-08-26T19:21:32.000000Z. More...
 

Static Public Member Functions

static long tm2Epoch (const struct tm *t)
 
static long convertHttpDateToEpoch (const char *date)
 returns: the number of seconds since the begining of 1970. More...
 
static void setTime (struct timespec gmt)
 returns: the number of seconds since the begining of 1970. More...
 
static void setTime (struct timespec gmt, int tzOffsetSecs, DstRule dstRule)
 
static void setTimeZone (int tzOffsetSecs, DstRule dstRule)
 param: (in) gmt - time relative to the beginning of 1970 (GMT) param: (in) tzOffsetSecs - local time offset (seconds relative to GMT) param: (in) dstRule - daylight savings time rule More...
 
static void getDayOfWeek (int year, int month, int dayOfMonth, int &dayOfWeek)
 
static void getLocalTimeString (UtlString &dateString)
 
static void getCurTime (OsDateTimeBase &rDateTime)
 
static void getCurTime (OsTime &rTime)
 
static void getCurTimeSinceBoot (OsTime &rTime)
 
static unsigned long getSecsSinceEpoch (void)
 

Static Public Attributes

static const char * spMonthStrings [12]
 
static const char * spDayStrings [7]
 

Protected Member Functions

 OsDateTimeBase ()
 
 OsDateTimeBase (const unsigned short year, const unsigned char month, const unsigned char day, const unsigned char hour, const unsigned char minute, const unsigned char second, const unsigned int microsecond)
 
 OsDateTimeBase (const OsDateTimeBase &rOsDateTime)
 
virtual ~OsDateTimeBase ()
 
OsDateTimeBaseoperator= (const OsDateTimeBase &rhs)
 

Protected Attributes

unsigned int mMicrosecond
 
unsigned short mYear
 
unsigned char mMonth
 
unsigned char mDay
 
unsigned char mHour
 
unsigned char mMinute
 
unsigned char mSecond
 

Static Protected Attributes

static DstRule sDstRule = OsDateTimeBase::DST_NONE
 
static int sDstYear = -1
 
static int sTzOffsetSecs = 0
 

Member Enumeration Documentation

enum DstRule
Enumerator
DST_NONE 
DST_NORTH_AMERICA 
DST_WESTERN_EUROPE 

Constructor & Destructor Documentation

OsDateTimeBase ( )
protected
OsDateTimeBase ( const unsigned short  year,
const unsigned char  month,
const unsigned char  day,
const unsigned char  hour,
const unsigned char  minute,
const unsigned char  second,
const unsigned int  microsecond 
)
protected

Microseconds (0 - 999999)

Parameters
yearXXXX year
month0-based month; 0=JAN, 1=FEB
day1-based day (1..31)
hourHour is 24-hour format (0..23)
minuteMinute (0..59)
secondSecond (0..59)
OsDateTimeBase ( const OsDateTimeBase rOsDateTime)
protected
~OsDateTimeBase ( )
protectedvirtual

Member Function Documentation

long tm2Epoch ( const struct tm *  t)
static
long convertHttpDateToEpoch ( const char *  date)
static

returns: the number of seconds since the begining of 1970.

void setTime ( struct timespec  gmt)
static

returns: the number of seconds since the begining of 1970.

static void setTime ( struct timespec  gmt,
int  tzOffsetSecs,
DstRule  dstRule 
)
static
void setTimeZone ( int  tzOffsetSecs,
DstRule  dstRule 
)
static

param: (in) gmt - time relative to the beginning of 1970 (GMT) param: (in) tzOffsetSecs - local time offset (seconds relative to GMT) param: (in) dstRule - daylight savings time rule

virtual OsStatus cvtToTimeSinceBoot ( OsTime rTime) const
pure virtual

param: (in) tzOffsetSecs - local time offset (seconds relative to GMT) param: (in) dstRule - daylight savings time rule

Implemented in OsDateTimeWnt, and OsDateTimeLinux.

OsStatus cvtToTimeSinceEpoch ( OsTime rTime) const
virtual
void getDayOfWeek ( int  year,
int  month,
int  dayOfMonth,
int &  dayOfWeek 
)
static
void getDayOfWeek ( int &  dayOfWeek)

param: (in) year - 4 digit year param: (in) month - 0-11 param: (in) dayOfMonth - the day of the month 1-31 param: (out) dayOfWeek - the day of the week 0-6

unsigned int getMicrosecond ( ) const
inline

param: (out) dayOfWeek - the day of the week 0-6

unsigned short getYear ( ) const
inline
unsigned char getMonth ( ) const
inline
unsigned char getDay ( ) const
inline
unsigned char getHour ( ) const
inline
unsigned char getMinute ( ) const
inline
unsigned char getSecond ( ) const
inline
void getHttpTimeString ( UtlString dataString)
virtual
void getLocalTimeString ( UtlString dateString)
static
void getSqlTimeStringZ ( UtlString dateString)

Set the dateString to the time as UTC time in a Postgres compatible format: 2002-08-26 19:21:32.000.

void getIsoTimeStringZ ( UtlString dateString)

Set the dateString to the time as UTC time in the following format: 2002-08-26T19:21:32.000Z.

void getIsoTimeStringZus ( UtlString dateString)

Set the dateString to the time as UTC time in the following format: 2002-08-26T19:21:32.000000Z.

static void getCurTime ( OsDateTimeBase rDateTime)
static
void getCurTime ( OsTime rTime)
static
static void getCurTimeSinceBoot ( OsTime rTime)
static
static unsigned long getSecsSinceEpoch ( void  )
static
OsDateTimeBase & operator= ( const OsDateTimeBase rhs)
protected

Member Data Documentation

const char * spMonthStrings
static
Initial value:
=
{
"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"
}
const char * spDayStrings
static
Initial value:
=
{
"Sun","Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
}
int sDstYear = -1
staticprotected
int sTzOffsetSecs = 0
staticprotected
unsigned int mMicrosecond
protected
unsigned short mYear
protected
unsigned char mMonth
protected
unsigned char mDay
protected
unsigned char mHour
protected
unsigned char mMinute
protected
unsigned char mSecond
protected