Haka
Data Structures | Typedefs | Enumerations | Functions
timer.h File Reference
#include <haka/types.h>
#include <haka/time.h>
#include <haka/thread.h>

Go to the source code of this file.

Data Structures

struct  time_realm
 

Typedefs

typedef void(* timer_callback) (int count, void *data)
 

Enumerations

Functions

bool time_realm_initialize (struct time_realm *realm, enum time_realm_mode mode)
 
bool time_realm_destroy (struct time_realm *realm)
 
void time_realm_update_and_check (struct time_realm *realm, const struct time *value)
 
const struct timetime_realm_current_time (struct time_realm *realm)
 
struct timer * time_realm_timer (struct time_realm *realm, timer_callback callback, void *user)
 
bool time_realm_check (struct time_realm *realm)
 
bool timer_init_thread ()
 
void timer_destroy (struct timer *timer)
 
bool timer_once (struct timer *timer, struct time *delay)
 
bool timer_repeat (struct timer *timer, struct time *delay)
 
bool timer_stop (struct timer *timer)
 

Detailed Description

Timer functions.

Typedef Documentation

typedef void(* timer_callback) (int count, void *data)

Opaque timer structure. Timer callback called whenever a timer triggers.

Enumeration Type Documentation

Timer mode.

Function Documentation

bool time_realm_check ( struct time_realm realm)

Check and execute timer callbacks.

const struct time* time_realm_current_time ( struct time_realm realm)

Get the current local time of the time realm.

bool time_realm_destroy ( struct time_realm realm)

Destroy a time realm.

bool time_realm_initialize ( struct time_realm realm,
enum time_realm_mode  mode 
)

Create a new time realm.

struct timer* time_realm_timer ( struct time_realm realm,
timer_callback  callback,
void *  user 
)

Create a new timer.

void time_realm_update_and_check ( struct time_realm realm,
const struct time value 
)

Update the time of a time realm that is in TIMER_REALM_STATIC mode. It does also check for timer to trigger.

void timer_destroy ( struct timer *  timer)

Destroy a timer.

bool timer_init_thread ( )

Initialize the current thread for timer support.

Returns
false if an error occurred.
bool timer_once ( struct timer *  timer,
struct time delay 
)

Start a timer to be trigger only once.

Returns
false if an error occurred.
bool timer_repeat ( struct timer *  timer,
struct time delay 
)

Start a timer to be repeated until it is stopped or destroyed.

Returns
false if an error occurred.
bool timer_stop ( struct timer *  timer)

Stop a timer.

Returns
false if an error occurred.