Home |
RTKernel-32 Programming Manual Multitasking, Real-Time, and RTKernel-32 Time Alternate APIs for RTKernel-32 |
TimeFor a real-time system, time is of great importance. RTKernel-32 maintains an interrupt-driven clock which can be set and read. Furthermore, a task can block itself for a certain time span in order to make CPU time available to other tasks. Time is expressed in timer ticks. RTKernel-32 uses type RTKTime to store absolute times and type RTKDuration to store time intervals. Both RTKTime and RTKDuration have type signed long and thus can span a range of 232 ticks. RTKernel-32 gets its timer interrupts from the clock device driver. The clock driver is only required to generate periodic interrupts. RTKernel-32 does not (and need not) know how much real time (i.e., time expressed in seconds) elapses between two consecutive timer ticks. For information on translating timer ticks to real time, please refer to Supplemental Modules, Module Clock. Since RTKernel-32's clock is limited to a resolution of 32 bits, an overflow will occur after 231 timer ticks. For example, if the timer interrupt interval is set to 1 millisecond, the first overflow will occur after about 25 days, followed by periodic overflows every 50 days. Such an overflow is no problem for RTKernel-32; the behavior of tasks is not affected by clock overflows. RTKernel-32 increments the clock from 2147483647 to -2147483648. Application programs storing times in variables of type RTKTime or RTKDuration are compatible with RTKernel-32's behavior. However, times stored in variables that overflow differently (e.g., floats or doubles), must be corrected by the application when RTKernel-32's clock overflows. The various time related API functions of RTKernel-32 are documented in the RTKernel-32 Reference Manual.
|