Main Page   Modules   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

TimeValue Class Reference
[OSCL Base]

The TimeValue class represents a time value in a format native to the system. More...

#include <oscl_time.h>


Public Methods

OSCL_COND_IMPORT_REF TimeValue ()
 Create a TimeValue representing the current time.

OSCL_COND_IMPORT_REF TimeValue (const TimeValue &Tv)
 Copy constructor.

OSCL_COND_IMPORT_REF TimeValue (long tv, TimeUnits units)
 Create a TimeValue representing an interval of tv units.

OSCL_COND_IMPORT_REF TimeValue (const OsclBasicTimeStruct &in_tv)
 Create a TimeValue representing the absolute time specified by the BasicTimeStruct.

OSCL_COND_IMPORT_REF TimeValue (OsclBasicDateTimeStruct in_ts)
 Create a TimeValue representing the absolute time specified by the BasicDateTimeStruct.

OSCL_COND_IMPORT_REF int32 get_local_time ()
 Get the local time after having adjusted for daylight saving.

OSCL_COND_IMPORT_REF void set_to_zero ()
 Set the time value to zero (represents a zero interval).

OSCL_COND_IMPORT_REF void set_to_current_time ()
 Set the time value to the current system time.

OSCL_COND_IMPORT_REF void set_from_ntp_time (const uint32 ntp_offset)
 This method coverts a 32-bit NTP offset to system time.

OSCL_COND_IMPORT_REF uint32 get_sec () const
 Get a 32 bit value representing the seconds since the (system dependent) epoch.

OSCL_COND_IMPORT_REF int32 to_msec () const
OSCL_COND_IMPORT_REF uint32 get_usec () const
 Get a 32 bit value representing the number of microseconds in the time value.

OSCL_IMPORT_REF char * get_str_ctime (CtimeStrBuf ctime_strbuf)
 Get a string containing a text representation of this TimeValue object.

OSCL_IMPORT_REF int get_pv8601_str_time (PV8601timeStrBuf time_strbuf)
 Get a PV extended text representation of the Time based on the ISO 8601 format.

OSCL_IMPORT_REF char * get_rfc822_gmtime_str (int max_time_strlen, char *time_str)
 Get a text representation of the time in the GMT timezone based on the RFC 822 / RFC 1123 (also described in the HTTP spec RFC 2068 and RFC 2616.

OSCL_COND_IMPORT_REF bool is_zero ()
 Determine if the time value is zero.

OSCL_COND_IMPORT_REF TimeValue & operator= (const TimeValue &a)
 Assignment operator.

OSCL_COND_IMPORT_REF TimeValue & operator+= (const TimeValue &a)
 += operator

OSCL_COND_IMPORT_REF TimeValue & operator-= (const TimeValue &a)
 -= operator

OSCL_COND_IMPORT_REF TimeValue & operator *= (const int scale)
 This operator scales the time value by a constant.

OSCL_COND_IMPORT_REF OsclBasicTimeStructget_timeval_ptr ()

Friends

class NTPTime
OSCL_COND_IMPORT_REF friend
bool 
operator== (const TimeValue &a, const TimeValue &b)
OSCL_COND_IMPORT_REF friend
bool 
operator!= (const TimeValue &a, const TimeValue &b)
OSCL_COND_IMPORT_REF friend
bool 
operator<= (const TimeValue &a, const TimeValue &b)
OSCL_COND_IMPORT_REF friend
bool 
operator>= (const TimeValue &a, const TimeValue &b)
OSCL_COND_IMPORT_REF friend
bool 
operator< (const TimeValue &a, const TimeValue &b)
OSCL_COND_IMPORT_REF friend
bool 
operator> (const TimeValue &a, const TimeValue &b)


Detailed Description

The TimeValue class represents a time value in a format native to the system.

This class provides common time functions independent of any OS. The actual representation used is native to the system that the class is compiled on to increase efficiency. Macros used in this class:

Definitions to determine the type of basic time structure used to store the time


Constructor & Destructor Documentation

OSCL_COND_IMPORT_REF TimeValue::TimeValue  
 

Create a TimeValue representing the current time.

OSCL_COND_IMPORT_REF TimeValue::TimeValue const TimeValue &    Tv
 

Copy constructor.

OSCL_COND_IMPORT_REF TimeValue::TimeValue long    tv,
TimeUnits    units
 

Create a TimeValue representing an interval of tv units.

Parameters:
tv  The number of units in the interval to be represented by this TimeValue.
units  The units of the tv argument. Must be in the enumeration TimeUnits.

OSCL_COND_IMPORT_REF TimeValue::TimeValue const OsclBasicTimeStruct   in_tv
 

Create a TimeValue representing the absolute time specified by the BasicTimeStruct.

Parameters:
in_tv  OsclBasicTimeStruct as defined for each platform.

OSCL_COND_IMPORT_REF TimeValue::TimeValue OsclBasicDateTimeStruct    in_ts
 

Create a TimeValue representing the absolute time specified by the BasicDateTimeStruct.

Parameters:
in_ts  OsclBasicDateTimeStruct as defined for each platform provides the date in a readable format (i.e. day, date , week etc.) Notes: Implementation incomplete (= not done) on Win32, Wince, Symbian


Member Function Documentation

OSCL_COND_IMPORT_REF int32 TimeValue::get_local_time  
 

Get the local time after having adjusted for daylight saving.

Notes: Implementation incomplete (= not done) on Win32, Wince, Symbian

OSCL_IMPORT_REF int TimeValue::get_pv8601_str_time PV8601timeStrBuf    time_strbuf
 

Get a PV extended text representation of the Time based on the ISO 8601 format.

Parameters:
time_strbuf  A PV8601timeStrBuf object to which the text representation will be written,
Returns:
The number of characters copied to the buffer, not including the terminating null. The returned string is of the form "19850412T101530.047Z".

OSCL_IMPORT_REF char* TimeValue::get_rfc822_gmtime_str int    max_time_strlen,
char *    time_str
 

Get a text representation of the time in the GMT timezone based on the RFC 822 / RFC 1123 (also described in the HTTP spec RFC 2068 and RFC 2616.

Parameters:
max_time_strlen  The maximum number of characters that can be written to the buffer.
time_str  A pointer to the buffer to which the characters will be written.
Returns:
Returns a pointer to the buffer (same as time_str) containing a null terminated (c-style) string of the form "Wed, 30 Jun 1993 21:49:08 GMT".

OSCL_COND_IMPORT_REF uint32 TimeValue::get_sec  
 

Get a 32 bit value representing the seconds since the (system dependent) epoch.

Returns:
This call returns a 32 bit value representing the nubmer of seconds since the epoch. On unix systems this represents the number of seconds since the unix epoch Jan 1 1970. On Win32 this represents the number of seconds since Jan 1, 1601. This is intended to be used for intervals rather than for absolute time. (On Win32 for example, a 32 bit value would be too small to represent the number of seconds from the epoch until the current time.)

OSCL_IMPORT_REF char* TimeValue::get_str_ctime CtimeStrBuf    ctime_strbuf
 

Get a string containing a text representation of this TimeValue object.

Parameters:
ctime_strbuf  A CtimeStrBuf object to which the text representation will be written,
Returns:
A pointer to the input CtimeStrBuf is returned. This string is null terminated of the form "Wed Jun 30 21:49:08 1993".

OSCL_COND_IMPORT_REF OsclBasicTimeStruct* TimeValue::get_timeval_ptr  
 

OSCL_COND_IMPORT_REF uint32 TimeValue::get_usec  
 

Get a 32 bit value representing the number of microseconds in the time value.

Returns:
Returns a uint32 value representing the number of microseconds in the time value after subtracting off the whole seconds.

OSCL_COND_IMPORT_REF bool TimeValue::is_zero  
 

Determine if the time value is zero.

OSCL_COND_IMPORT_REF TimeValue& TimeValue::operator *= const int    scale
 

This operator scales the time value by a constant.

OSCL_COND_IMPORT_REF TimeValue& TimeValue::operator+= const TimeValue &    a
 

+= operator

OSCL_COND_IMPORT_REF TimeValue& TimeValue::operator-= const TimeValue &    a
 

-= operator

OSCL_COND_IMPORT_REF TimeValue& TimeValue::operator= const TimeValue &    a
 

Assignment operator.

OSCL_COND_IMPORT_REF void TimeValue::set_from_ntp_time const uint32    ntp_offset
 

This method coverts a 32-bit NTP offset to system time.

This method takes a 32-bit ntp offset which is the number of seconds from 0 h Jan 1, 1900 and converts it to the system time

OSCL_COND_IMPORT_REF void TimeValue::set_to_current_time  
 

Set the time value to the current system time.

OSCL_COND_IMPORT_REF void TimeValue::set_to_zero  
 

Set the time value to zero (represents a zero interval).

OSCL_COND_IMPORT_REF int32 TimeValue::to_msec  
 


Friends And Related Function Documentation

friend class NTPTime [friend]
 

OSCL_COND_IMPORT_REF friend bool operator!= const TimeValue &    a,
const TimeValue &    b
[friend]
 

OSCL_COND_IMPORT_REF friend bool operator< const TimeValue &    a,
const TimeValue &    b
[friend]
 

OSCL_COND_IMPORT_REF friend bool operator<= const TimeValue &    a,
const TimeValue &    b
[friend]
 

OSCL_COND_IMPORT_REF friend bool operator== const TimeValue &    a,
const TimeValue &    b
[friend]
 

OSCL_COND_IMPORT_REF friend bool operator> const TimeValue &    a,
const TimeValue &    b
[friend]
 

OSCL_COND_IMPORT_REF friend bool operator>= const TimeValue &    a,
const TimeValue &    b
[friend]
 


The documentation for this class was generated from the following file:
OSCL API
Posting Version: OPENCORE_20090310