Interface: moteiv.tos.lib.timer.GlobalTime

interface GlobalTime<typedef precision_tag>

Acquisition of a global time source with a given precision.

Parameters:
precision_tag - The precision of the time source, ie T32khz or TMilli
Author:
Joe Polastre, Moteiv Corporation <info@moteiv.com>

Commands
command uint32_t convertToGlobal(uint32_t local) Converts a local time to the global time.
command uint32_t convertToLocal(uint32_t global) Converts a global time to the local time.
command uint32_t get() Get the current global time value.
command global_time_t getBoth() Get both the global and local time at the same instance (prevents calling both LocalTime and GlobalTime in sequence, and having inaccuracies in timing calculations).
command bool isValid() Notifies the caller if the global time has been established.

Commands - Details

convertToGlobal

command uint32_t convertToGlobal(uint32_t local)

Converts a local time to the global time.

Parameters:
local - The local time to convert to global time
Returns:
Global time value

convertToLocal

command uint32_t convertToLocal(uint32_t global)

Converts a global time to the local time.

Parameters:
local - The global time to convert to local time
Returns:
Local time value

get

command uint32_t get()

Get the current global time value.

Returns:
a 32-bit value with the units of precision_tag

getBoth

command global_time_t getBoth()

Get both the global and local time at the same instance (prevents calling both LocalTime and GlobalTime in sequence, and having inaccuracies in timing calculations).

Returns:
A struct (global_time_t) returning both the global time accessible through .global and the local time accessible through .local

isValid

command bool isValid()

Notifies the caller if the global time has been established.

Returns:
TRUE if the time is valid, FALSE if no time has been established globally by this node.