Time Service#

This module includes the platform abstraction for the time service.

Functions#

uint64_t

Get the current platform time in microseconds referenced to a continuous monotonic local clock (64 bits width).

uint16_t

Get the current estimated worst case accuracy (maximum ± deviation from the nominal frequency) of the local platform clock in units of PPM.

Function Documentation#

otPlatTimeGet#

uint64_t otPlatTimeGet (void)

Get the current platform time in microseconds referenced to a continuous monotonic local clock (64 bits width).

Parameters
N/A

The clock SHALL NOT wrap during the device's uptime. Implementations SHALL therefore identify and compensate for internal counter overflows. The clock does not have a defined epoch and it SHALL NOT introduce any continuous or discontinuous adjustments (e.g. leap seconds). Implementations SHALL compensate for any sleep times of the device.

Implementations MAY choose to discipline the platform clock and compensate for sleep times by any means (e.g. by combining a high precision/low power RTC with a high resolution counter) as long as the exposed combined clock provides continuous monotonic microsecond resolution ticks within the accuracy limits announced by otPlatTimeGetXtalAccuracy.

Returns

  • The current time in microseconds.


Definition at line 73 of file include/openthread/platform/time.h

otPlatTimeGetXtalAccuracy#

uint16_t otPlatTimeGetXtalAccuracy (void)

Get the current estimated worst case accuracy (maximum ± deviation from the nominal frequency) of the local platform clock in units of PPM.

Parameters
N/A

Note

  • Implementations MAY estimate this value based on current operating conditions (e.g. temperature).

In case the implementation does not estimate the current value but returns a fixed value, this value MUST be the worst-case accuracy over all possible foreseen operating conditions (temperature, pressure, etc) of the implementation.

Returns

  • The current platform clock accuracy, in PPM.


Definition at line 90 of file include/openthread/platform/time.h