#api #xous


Provide high-resolution, non-rollover system time

48 releases

0.9.47 Sep 12, 2023
0.9.44 Jul 19, 2023
0.9.31 Mar 21, 2023
0.9.23 Dec 30, 2022
0.9.21 Nov 26, 2022

#183 in Operating systems

Download history 104/week @ 2023-06-08 142/week @ 2023-06-15 29/week @ 2023-06-22 182/week @ 2023-06-29 133/week @ 2023-07-06 45/week @ 2023-07-13 65/week @ 2023-07-20 215/week @ 2023-07-27 71/week @ 2023-08-03 56/week @ 2023-08-10 69/week @ 2023-08-17 62/week @ 2023-08-24 8/week @ 2023-08-31 99/week @ 2023-09-07 26/week @ 2023-09-14 64/week @ 2023-09-21

199 downloads per month
Used in xous-ticktimer



Xous API: ticktimer

The Xous ticktimer helps other processes track the passage of time through several mechanisms:

  • It can report the elapsed uptime since boot in milliseconds.
  • It can block a process for a specified number of milliseconds.
  • It can block a process until a condition is met (i.e., condvar)

Processes that are blocked by ticktimer are entirely de-scheduled and consume no CPU quantum; the only overhead is a few instructions to check the processes' runnability state in the kernel's simple round-robin thread scheduler. Thus sleep and condvar blocking states are very efficient.

ticktimer's perception of time stops when a system goes into the suspend state; thus on resume, the elapsed time picks up exactly where it left off. Wall-clock time during suspend is tracked by the RTC module.

Xous currently has no notions of thread priority, but if it were to develop one, the ticktimer would be the logical place to implement such a feature, as it has a full view of all the waiting and runnable threads, and it can influence which ones should be unblocked at a given quantum.


~50K SLoC