CLK_getltime
2-52
C Interface
Syntax
currtime = CLK_getltime();
Parameters
Void
Return Value
LgUns
currtime
/* low-resolution time */
Reentrant
yes
Description
CLK_getltime returns the number of timer interrupts that have occurred
as a 32-bit time value. When the number of interrupts reaches the
maximum value that can be stored in 32 bits, value wraps back to 0 on
the next interrupt.
The low-resolution time is the number of timer interrupts that have
occurred. See “Low-Resolution Time” on page 2-41 for information about
how this rate is set.
The default low resolution interrupt rate is 1 millisecond/interrupt. By
adjusting the period register, you can set rates from less than 1
microsecond/interrupt to more than 1 second/interrupt.
CLK_gethtime provides a value with more accuracy than CLK_getltime,
but which wraps back to 0 more frequently. For example, if the timer tick
rate is 80 MHz, and you use the default period register value of 40000,
the CLK_gethtime value wraps back to 0 approximately every 107
seconds, while the CLK_getltime value wraps back to 0 approximately
every 49.7 days.
CLK_getltime is often used to add a time stamp to event logs for events
that occur over a relatively long period of time.
Constraints and
Calling Context
❏
CLK_getltime cannot be called from the program’s main() function.
Example
/* ======== showTicks ======== */
Void showTicks
{
LOG_printf(&trace, "time = 0x%x %x",
(Int)(CLK_getltime() >> 16), (Int)CLK_getltime());
}
See Also
CLK_gethtime
PRD_getticks
STS_delta
CLK_getltime
Get low-resolution time