nl::Weave::Platform::Time

Summary

Functions

GetMonotonicRawTime(Profiles::Time::timesync_t *const p_timestamp_usec)
NL_DLL_EXPORT WEAVE_ERROR
get CLOCK_MONOTONIC_RAW, CLOCK_MONOTONIC, or equivalent clock reading.
GetSleepCompensatedMonotonicTime(Profiles::Time::timesync_t *const p_timestamp_usec)
NL_DLL_EXPORT WEAVE_ERROR
get CLOCK_BOOTTIME or equivalent clock reading.
GetSystemTime(Profiles::Time::timesync_t *const p_timestamp_usec)
NL_DLL_EXPORT WEAVE_ERROR
get CLOCK_REALTIME or equivalent clock reading.
GetSystemTimeMs(Profiles::Time::timesync_t *const p_timestamp_msec)
NL_DLL_EXPORT WEAVE_ERROR
get CLOCK_REALTIME or equivalent clock reading in ms.
SetSystemTime(const Profiles::Time::timesync_t timestamp_usec)
NL_DLL_EXPORT WEAVE_ERROR
set CLOCK_REALTIME or equivalent clock.

Functions

GetMonotonicRawTime

NL_DLL_EXPORT WEAVE_ERROR GetMonotonicRawTime(
  Profiles::Time::timesync_t *const p_timestamp_usec
)

get CLOCK_MONOTONIC_RAW, CLOCK_MONOTONIC, or equivalent clock reading.

This clock is used to timestamp events that happen with short time in between them. Higher resolution is expected but doesn't have to be compensated for sleep time. Note that it is okay if it comes with sleep time compensation, but higher resolution is the key. Without better alternatives, this can be implemented by GetSleepCompensatedMonotonicTime.

Details
Parameters
[out] p_timestamp_usec
A pointer to the clock reading
Returns
WEAVE_NO_ERROR on success

GetSleepCompensatedMonotonicTime

NL_DLL_EXPORT WEAVE_ERROR GetSleepCompensatedMonotonicTime(
  Profiles::Time::timesync_t *const p_timestamp_usec
)

get CLOCK_BOOTTIME or equivalent clock reading.

This clock is used to timestamp events that happen long time apart. Highest resolution is not the concern but it must be compensated for sleep time.

Details
Parameters
[out] p_timestamp_usec
A pointer to the clock reading
Returns
WEAVE_NO_ERROR on success

GetSystemTime

NL_DLL_EXPORT WEAVE_ERROR GetSystemTime(
  Profiles::Time::timesync_t *const p_timestamp_usec
)

get CLOCK_REALTIME or equivalent clock reading.

Details
Parameters
[out] p_timestamp_usec
A pointer to the clock reading
Returns
WEAVE_NO_ERROR on success

GetSystemTimeMs

NL_DLL_EXPORT WEAVE_ERROR GetSystemTimeMs(
  Profiles::Time::timesync_t *const p_timestamp_msec
)

get CLOCK_REALTIME or equivalent clock reading in ms.

Details
Parameters
[out] p_timestamp_msec
A pointer to the clock reading
Returns
WEAVE_NO_ERROR on success

SetSystemTime

NL_DLL_EXPORT WEAVE_ERROR SetSystemTime(
  const Profiles::Time::timesync_t timestamp_usec
)

set CLOCK_REALTIME or equivalent clock.

Details
Parameters
[in] timestamp_usec
intended new value for CLOCK_REALTIME
Returns
WEAVE_NO_ERROR on success