class Time

Defined at line 59 of file ../../third_party/openthread/src/core/common/time.hpp

Represents a time instance.

Public Members

static const uint32_t kOneMinuteInSec
static const uint32_t kOneHourInSec
static const uint32_t kOneDayInSec
static const uint32_t kOneSecondInMsec
static const uint32_t kOneMinuteInMsec
static const uint32_t kOneHourInMsec
static const uint32_t kOneDayInMsec
static const uint32_t kOneMsecInUsec
static const uint32_t kOneSecondInUsec
static const uint32_t kMaxDuration

Public Methods

void Time ()

This is the default constructor for a `Time` object.

Defined at line 82 of file ../../third_party/openthread/src/core/common/time.hpp

void Time (uint32_t aValue)

Initializes a `Time` object with a given value.

Parameters

aValue [in] The numeric time value to initialize the `Time` object.

Defined at line 89 of file ../../third_party/openthread/src/core/common/time.hpp

uint32_t GetValue ()

Gets the numeric time value associated with the `Time` object.

Defined at line 96 of file ../../third_party/openthread/src/core/common/time.hpp

void SetValue (uint32_t aValue)

Sets the numeric time value.

Parameters

aValue [in] The numeric time value.

Defined at line 103 of file ../../third_party/openthread/src/core/common/time.hpp

uint32_t operator- (const Time & aOther)

Calculates the time duration between two `Time` instances.

Parameters

aOther [in] A `Time` instance to subtract from.

Defined at line 117 of file ../../third_party/openthread/src/core/common/time.hpp

Time operator+ (uint32_t aDuration)

Returns a new `Time` which is ahead of this `Time` object by a given duration.

Parameters

aDuration [in] A duration.

Defined at line 126 of file ../../third_party/openthread/src/core/common/time.hpp

Time operator- (uint32_t aDuration)

Returns a new `Time` which is behind this `Time` object by a given duration.

Parameters

aDuration [in] A duration.

Defined at line 135 of file ../../third_party/openthread/src/core/common/time.hpp

void operator+= (uint32_t aDuration)

Moves this `Time` object forward by a given duration.

Parameters

aDuration [in] A duration.

Defined at line 142 of file ../../third_party/openthread/src/core/common/time.hpp

void operator-= (uint32_t aDuration)

Moves this `Time` object backward by a given duration.

Parameters

aDuration [in] A duration.

Defined at line 149 of file ../../third_party/openthread/src/core/common/time.hpp

bool operator== (const Time & aOther)

Indicates whether two `Time` instances are equal.

Parameters

aOther [in] A `Time` instance to compare with.

Defined at line 159 of file ../../third_party/openthread/src/core/common/time.hpp

bool operator< (const Time & aOther)

Indicates whether this `Time` instance is strictly before another one.

Parameters

aOther [in] A `Time` instance to compare with.

Defined at line 175 of file ../../third_party/openthread/src/core/common/time.hpp

bool operator>= (const Time & aOther)

Indicates whether this `Time` instance is after or equal to another one.

Parameters

aOther [in] A `Time` instance to compare with.

Defined at line 185 of file ../../third_party/openthread/src/core/common/time.hpp

bool operator<= (const Time & aOther)

Indicates whether this `Time` instance is before or equal to another one.

Parameters

aOther [in] A `Time` instance to compare with.

Defined at line 195 of file ../../third_party/openthread/src/core/common/time.hpp

bool operator> (const Time & aOther)

Indicates whether this `Time` instance is strictly after another one.

Parameters

aOther [in] A `Time` instance to compare with.

Defined at line 205 of file ../../third_party/openthread/src/core/common/time.hpp

Time GetDistantFuture ()

Returns a new `Time` instance which is in distant future relative to current `Time` object.

The distant future is the largest time that is ahead of `Time`. For any time `t`, if `(*this

<

= t)`, then

`t

<

= this->GetGetDistantFuture()`, except for the ambiguous `t` value which is half range `(1

<

<

31)` apart.

When comparing `GetDistantFuture()` with a time `t` the caller must ensure that `t` is already ahead of `*this`.

Defined at line 217 of file ../../third_party/openthread/src/core/common/time.hpp

Time GetDistantPast ()

Returns a new `Time` instance which is in distant past relative to current `Time` object.

The distant past is the smallest time that is before `Time`. For any time `t`, if `(t

<

= *this )`, then

`this->GetGetDistantPast()

<

= t`, except for the ambiguous `t` value which is half range `(1

<

<

31)` apart.

When comparing `GetDistantPast()` with a time `t` the caller must ensure that the `t` is already before `*this`.

Defined at line 229 of file ../../third_party/openthread/src/core/common/time.hpp

uint32_t SecToMsec (uint32_t aSeconds)

Converts a given number of seconds to milliseconds.

Parameters

aSeconds [in] The seconds value to convert to milliseconds.

Defined at line 238 of file ../../third_party/openthread/src/core/common/time.hpp

uint32_t MsecToSec (uint32_t aMilliseconds)

Converts a given number of milliseconds to seconds.

Parameters

aMilliseconds [in] The milliseconds value to convert to seconds.

Defined at line 247 of file ../../third_party/openthread/src/core/common/time.hpp