#include <nitro/os.h>
#define OS_TicksToMicroSeconds( tick )
#define OS_TicksToMicroSeconds32( tick )
#define OS_TicksToMilliSeconds( tick )
#define OS_TicksToMilliSeconds32( tick )
#define OS_TicksToSeconds( tick )
#define OS_TicksToSeconds32( tick )
(These are all macros.)
tick | Tick Value |
The actual time that corresponds to the tick value that is specified in the argument.
This function obtains the actual time that corresponds to the tick value that is specified in the argument.
One tick unit is 1/64 of the system clock.
OS_TicksToMicroSeconds*()
converts the tick value to microseconds.OS_TicksToMilliSeconds*()
converts the tick value to milliseconds.OS_TicksToSeconds*()
converts the tick value to seconds.
These functions are all defined as macros.
Functions with 32
in their names conduct 32-bit internal calculations. Those without 32
conduct 64-bit calculations. 32-bit versions handle smaller values than 64-bit versions, so they cannot always return correct results because of overflow. However, when there is no overflow, they have the advantage of keeping the code smaller, making operating speed faster. However, since the degree of difference is not that great, and to prevent bugs, we recommend you use functions that do not include 32
in the name. Furthermore, when a constant is made into an argument, it is calculated just before compiling and the resulting value is also a constant.
When operating in 32-bit mode, be careful of overflow. Values that will cause overflow are in the following table.
Function Name | This value or less is OK. | Beyond this value is not allowed. |
---|---|---|
OS_TicksToSeconds32() |
67108863 (tick units) This value is approximately 2 seconds. |
67108864 (tick units) |
OS_TicksToMilliSeconds32() |
67108863 (tick units) This value is approximately 2002 milliseconds (2 seconds). |
67108864 (tick units) |
OS_TicksToMicroSeconds32() |
67108 (tick units) This value is approximately 2002 microseconds (0.000002 seconds). |
67109 (tick units) |
Further, values that overflow in 64-bit operation are: about 2.8 x 10 to the 14th tick units (about 99 days) for OS_TicksToMicroSeconds*()
, and 2.8 x 10 to the 17th tick units (about 272 years) for OS_TicksToMilliSeconds*()
and OS_TicksToSeconds*()
.
OS_InitTick
OS_GetTick
OS_SetAlarm
OS_SetPeriodicAlarm
OS_*SecondsToTicks
2005/10/07 Changed differences between 32-bit and 64-bit operation.
2005/10/06 Considered and changed overflow for 32-bit and 64-bit operation.
2004/02/25 Changed Count to Tick.
2004/02/24 Initial version.
CONFIDENTIAL