Contiki 2.5
Macros | Functions
Clock library

The clock library is the interface between Contiki and the platform specific clock functionality. More...

Macros

#define CLOCK_SECOND
 A second, measured in system clock time.
 

Functions

void clock_init (void)
 Initialize the clock library. More...
 
CCIF clock_time_t clock_time (void)
 Get the current clock time. More...
 
void clock_delay (unsigned int)
 Delay the CPU for a multiple of TODO.
 

Detailed Description

The clock library is the interface between Contiki and the platform specific clock functionality.

The clock library performs a single function: measuring time. Additionally, the clock library provides a macro, CLOCK_SECOND, which corresponds to one second of system time.

Note
The clock library need in many cases not be used directly. Rather, the timer library or the event timers should be used.
See Also
Timer library
Event timers

Function Documentation

void clock_init ( void  )

Initialize the clock library.

This function initializes the clock library and should be called from the main() function of the system.

set Timer/Counter0 to be asynchronous from the CPU clock with a second external clock(32,768kHz) driving it.

Wait for TCN0UB, OCR0UB, and TCR0UB.

Definition at line 37 of file clock.c.

References ATOMIC, CLOCK_SECOND, NULL, and TICK_VAL.

Referenced by main().

CCIF clock_time_t clock_time ( void  )

Get the current clock time.

This function returns the current system clock time.

Returns
The current clock time, measured in system ticks.
Examples:
example-rucb.c, and example-rudolph2.c.

Definition at line 42 of file clock.c.

References NULL.

Referenced by clock_wait(), delivery_deliver_bundle(), discovery_basic_refresh_neighbour(), discovery_basic_save_neighbour(), PROCESS_THREAD(), routing_flooding_blacklist_add(), timer_expired(), timer_remaining(), timer_restart(), and timer_set().