Time management

Some of products require the precisely information of time. The time module should only allows delivering the number of clock "ticks" from the startup time. This value is returned by arGetTickCount function. The number of "ticks" in one second should be defined in a AR_TICKS_PER_SECOND constant. One millisecond interval is recommended, and it is represented by value of 1000. If more precisely time is used, it has to be determined by the adequate value. Please note that the time argument passed in to system functions (like osSleep or osWaitForObject) is specified by time units and it depends on value of AR_TICKS_PER_SECOND constant.

The time can be stored in TIME type variables. This type depends on architecture. Often it is 32-bit wide unsigned integer. This allows to count up to 322-1 and then rollover to 0. For one millisecond interval, the roll over will happen after circa 49,7 days. It can be avoided by using 64-bit wide integer. Please refer to corresponding description of the operating system scheduling into system time section, if the system is used.

The following table presents the rollover time occurrence for different configurations:

 Ticks per secondTick intervalRollover after
32-bit10010 ms497,10 days
*32-bit1 0001 ms49,71 days
32-bit10 000100 us119,30 hours
64-bit1 0001 ms584 942 417 years
64-bit1 000 0001 us584 942 years
*64-bit1 000 000 0001 ns584,94 years

* Represents a recommended configuration for 32-bit and 64-bit TIMEtype.

Two additional time definitions can be used: the AR_TIME_IGNORE that should be set to 0 (zero) and the AR_TIME_INFINITE that should have maximal value that may be stored in the variable of TIME type. For more details, please refer to their descriptions.

SpaceShadow documentation