#include <oscl_time.h>
Public Methods | |
OSCL_COND_IMPORT_REF | NTPTime () |
The default constructor creates an NTPTime instance representing the current system time. | |
OSCL_COND_IMPORT_REF | NTPTime (const NTPTime &src) |
Copy constructor to create a new NTPTime from an existing one. | |
OSCL_COND_IMPORT_REF | NTPTime (const uint32 seconds) |
Construct an NTPTime from a uint32. | |
OSCL_COND_IMPORT_REF | NTPTime (const int32 seconds) |
Construct an NTPTime from a int. | |
OSCL_COND_IMPORT_REF | NTPTime (const TimeValue &t) |
Construct a NTPTime instance from a TimeValue instance. | |
OSCL_COND_IMPORT_REF | NTPTime (const uint64 value) |
Construct a NTPTime instance from a uint64 value. | |
OSCL_COND_IMPORT_REF NTPTime & | operator= (uint32 newval) |
The assignment operator for a 32 bit integer. | |
OSCL_COND_IMPORT_REF NTPTime & | operator= (uint64 newval) |
The assignment operator for a 64 bit integer. | |
OSCL_COND_IMPORT_REF NTPTime & | operator+= (uint64 val) |
The += operator is used to add a 64 bit 32.32 value to an existing NTPTime value. | |
OSCL_COND_IMPORT_REF NTPTime | operator- (const NTPTime &ntpt) const |
The - operator allows subtraction of one NTPTime value from another. This is useful to measure an interval. | |
void | set_from_system_time (const uint32 systemtime) |
This method converts a 32-bit system time to NTP time. | |
OSCL_COND_IMPORT_REF uint32 | get_middle32 () const |
Grab the middle 32 bits of the 64 bit 32.32 representation. | |
OSCL_COND_IMPORT_REF uint32 | get_upper32 () const |
This method returns the upper 32 bits of the 32.32 representation. | |
OSCL_COND_IMPORT_REF uint32 | get_lower32 () const |
This method returns the lower 32 bits of the 32.32 representation. | |
int32 | to_system_time () const |
This method converts the ntp time value to system time. | |
OSCL_COND_IMPORT_REF uint64 | get_value () const |
This method returns the 32.32 ntp representation. | |
OSCL_IMPORT_REF int | set_to_current_time () |
This method sets the 32.32 representation to the current system time value. |
The NTPTime class: Conversion to/from Unix (epoch at 0h Jan. 1, 1970) amount to addition/subtraction of 2208988800. A single 64 bit value is used to represent the time. This value represents the number of seconds since 0h (UTC) Jan. 1, 1900. There is an implied binary point betweeen the upper 32 bits and lower 32 bits (this is referred to as a 32.32 fractional representation). For example a binary value of 00000000 00000000 00000000 00000011 10000000 00000000 00000000 00000000 represents 3.5 seconds since Jan 1, 1900.
|
The default constructor creates an NTPTime instance representing the current system time.
|
|
Copy constructor to create a new NTPTime from an existing one.
|
|
Construct an NTPTime from a uint32.
|
|
Construct an NTPTime from a int.
|
|
Construct a NTPTime instance from a TimeValue instance. This constructor creates an NTPTime value representing the same absolute time as the TimeValue parameter.
|
|
Construct a NTPTime instance from a uint64 value.
|
|
This method returns the lower 32 bits of the 32.32 representation.
|
|
Grab the middle 32 bits of the 64 bit 32.32 representation.
|
|
This method returns the upper 32 bits of the 32.32 representation.
|
|
This method returns the 32.32 ntp representation.
|
|
The += operator is used to add a 64 bit 32.32 value to an existing NTPTime value.
|
|
The - operator allows subtraction of one NTPTime value from another. This is useful to measure an interval.
|
|
The assignment operator for a 64 bit integer.
|
|
The assignment operator for a 32 bit integer.
|
|
This method converts a 32-bit system time to NTP time. This method sets the value of the NTPTime instance to the absolute time represented by the 32 bit input argument.
|
|
This method sets the 32.32 representation to the current system time value.
|
|
This method converts the ntp time value to system time. This method returns a 32 bit value representing the same absolute time as the NTP time value, but expressed as whole seconds since the unix epoch. The fractional part of the ntp value is discarded. |