Timing and delays


Functions

unsigned long os_current_time_ms (void)
int os_sleep_ms (unsigned ms)
int os_delay_us (unsigned us)
bool os_time_after (unsigned long a, unsigned long b)

Function Documentation

unsigned long os_current_time_ms ( void   ) 

Return the current time (since an arbitrary point) in milliseconds.

The resolution depends on the OS but would typically be 10 ms or better.

Callable from: any context.

Returns:
current time in ms.

int os_delay_us ( unsigned  us  ) 

Delay a minimum length of time.

This may busy-wait and should not be used for long delays (use os_sleep_ms() instead).

Callable from: any context.

Parameters:
us minimum time to delay (in us).

int os_sleep_ms ( unsigned  ms  ) 

Sleep for a minimum length of time.

Callable from: thread context.

Parameters:
ms minimum time to sleep (in ms).

bool os_time_after ( unsigned long  a,
unsigned long  b 
)

Check if some time has elapsed.

Callable from: any context.

Parameters:
a a time returned by os_current_time_ms().
b a time returned by os_current_time_ms().
Returns:
true if time a is after time b.


Generated on Wed Oct 27 15:14:03 2010 for oska by  doxygen 1.5.5