The current time is held as a 32 bit number in the ctl_current_time variable.

typedef unsigned long CTL_TIME_t;

....

extern CTL_TIME_t ctl_current_time;

You can suspend execution of a task for a fixed period using the ctl_task_wait function.

To use the ctl_current_time variable you must enable a periodic interrupt service routine that calls the ctl_increment_tick_from_isr function with interrupts disabled.

void ctl_increment_tick_from_isr(void);

Timer support is optional - remember that you can always use event sets to wakeup tasks from a timer ISR.

Timer usage example

ctl_task_wait(CTL_STATE_TIMER_WAIT, ctl_current_time+100, 0, 0);

This example suspends execution of the calling task for 100 increments of the ctl_current_time variable.