Apps     Components     Interfaces     All Files     Source Tree     source: tos.interfaces.TimeUtil.nc

Interface: TimeUtil

The TimeUtil interface provides utility commands for handling logical time or other 64 bits intergers in Mica platform.
Author: Su Ping <sping@intel-research.net>

Components providing this interface:
tos.system.LogicalTime
tos.system.SimpleTime
tos.system.TimeUtilC

Components requiring this interface:
tos.lib.TinyDB.SimpleTimeM
tos.lib.TinyDB.TupleRouterM
tos.system.ServiceSchedulerM
tos.system.SimpleTimeM

Commands

Commands - Details

addint32

tos_time_t addint32(tos_time_t a, int32_t x)

Add a signed 32 bits integer to a logical time

Parameters:

a - Logical Time

x - A 32 bit integer. If it represent a time, the unit should be binary milliseconds

Returns: The new time in tos_time_t format.

addUint32

tos_time_t addUint32(tos_time_t a, uint32_t x)

Add a unsigned 32 bits integer to a logical time

Parameters:

a - Logical Time

x - A unsigned 32 bit integer. If it represent a time, the unit should be binary milliseconds

Returns: The difference in tos_time_t format.

subtractUint32

tos_time_t subtractUint32(tos_time_t a, uint32_t x)

Subtract a unsigned 32 bits integer from a logical time

Parameters:

a - Logical Time

x - A unsigned 32 bit integer. If it represent a time, the unit should be binary milliseconds

Returns: The result in tos_time_t format.

compare

char compare(tos_time_t a, tos_time_t b)

Compare logical time a and b. If a>b return 1, if a=b return 0 if a