All netlib timers, timeouts and timing loops use simple uint32_t counters. Thus no timing interrupt is required for proper function. Especially on low-performance DSP with limited hardware timer resource all HW timers are often occupied by signal-processing tasks.
If a HW timer is still available in your application or your application uses SYS/BIOS, this module can be used to install an interrupt driven system timer or a Clock function in SYS/BIOS resp. for a high precision timing purpose. This time base can also be used to trigger the internal network timers to get a more accurate timing result for network tasks.
All Support SW examples make use of the system timer to trigger events, display progress bars or print time-stamps.
Function call
installs a HW system timer and sets the current time to application build time. Choose a free timer port that is not already occupied in your application. Parameter resolution specifies the timer granularity. Use predifened values from timer.h:
The system timer uses a combined data structure for seconds and micro seconds:
A global accessible variable of data type timeval can be used to get the current time:
During SetupSystemTime() the local time is set to current build time. To print the current local UTC time use:
If your system uses a RTC or is time synchronized via NTP use the following sequence to set the local time:
If started, the system timer can easily be used to measure loop execution time at timer resolution granularity. Use function