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

# 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 (const ISO8601timeStrBuf time_strbuf)
OSCL_COND_IMPORT_REF | TimeValue (uint16 aYear, uint16 aMonth, uint16 aDay, uint16 aHour, uint16 aMinute, uint16 aSecond, uint16 aMilliseconds)
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_COND_IMPORT_REF uint64 | get_timevalue_in_usec () const
| Get a 64 bit value representing the time value converted to microseconds.
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 PV 8601 format.
OSCL_IMPORT_REF int | get_ISO8601_str_time (ISO8601timeStrBuf 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 bool | is_zulu () const
| Manipulate internal flags to mark the time value as being in "zulu" (GMT) time.
OSCL_COND_IMPORT_REF void | set_zulu (bool is_zulu)
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 OsclBasicTimeStruct * | get_timeval_ptr ()
OSCL_COND_IMPORT_REF TimeValue & | operator+= (const int32 aSeconds)
OSCL_COND_IMPORT_REF TimeValue & | operator-= (const int32 aSeconds)
## 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:

- OSCL_HAS_ANSI_STRING_SUPPORT:

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

- OSCL_HAS_UNIX_TIME_FUNCS
- OSCL_HAS_SYMBIAN_SUPPORT
- OSCL_HAS_MSWIN_SUPPORT

## 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 | ( | const ISO8601timeStrBuf | time_strbuf | ) |

OSCL_COND_IMPORT_REF TimeValue::TimeValue | ( | uint16 | aYear,
|  | uint16 | aMonth,
|  | uint16 | aDay,
|  | uint16 | aHour,
|  | uint16 | aMinute,
|  | uint16 | aSecond,
|  | uint16 | aMilliseconds
| ) |

  | TimeValue constructor that sets time according to following input parameter for a specific date time. Please note that no argument is check for its validity (range etc) It might assert incase wrong argument are passed by user of this api. Parameters:
  in | ] uint16 wYear;
  in | ] uint16 wMonth; Jan = 1 to Dec = 12
  in | ] uint16 wDay; 1-28/29/30/31
  in | ] uint16 wHour; 0 to 23
  in | ] uint16 wMinute; 0 to 59
  in | ] uint16 wSecond; 0 to 59
  in | ] uint16 wMilliseconds; 0 to 999

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_IMPORT_REF int TimeValue::get_ISO8601_str_time | ( | ISO8601timeStrBuf | time_strbuf | ) |

  | Get a PV extended text representation of the Time based on the ISO 8601 format. Parameters:
  time_strbuf | A ISO8601timeStrBuf 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 "1985-04-12 10:15:30Z".

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 PV 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 uint64 TimeValue::get_timevalue_in_usec | ( |  | ) |

| Get a 64 bit value representing the time value converted to microseconds. Returns: Returns a uint64 value representing the time value in terms of microseconds.The The time origin is dependent on platform for which OSCL is compiled. For example for symbian it is midnight, January 1st, 0 AD for windows it is January 1, 1601 (UTC)

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 bool TimeValue::is_zulu | ( |  | ) |

| Manipulate internal flags to mark the time value as being in "zulu" (GMT) time.

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 int32 | aSeconds | ) |

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

| += operator

OSCL_COND_IMPORT_REF TimeValue& TimeValue::operator-= | ( | const int32 | aSeconds | ) |

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 void TimeValue::set_zulu | ( | bool | is_zulu | ) |

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_time.h