# timer.h File Reference

## Detailed Description

Interface for Timer functions.

This module is inspired by Jörg Wunschs timer implementation, which can be found here: http://sax.sax.de/~joerg/avr-timer/

Definition in file timer.h.

Go to the source code of this file.

## Data Structures
struct | time_stamp_tag
## Defines
#define | MSEC(v) ((time_t)(v / (1.0e3 * TIMER_TICK)))
#define | NONE_TIMER (0)
#define | USEC(v) ((time_t)(v / (1.0e6 * TIMER_TICK)))
## Typedefs
typedef struct time_stamp_tag | time_stamp_t
typedef uint32_t | time_t
typedef uint32_t | timer_arg_t
typedef time_t( | timer_handler_t )(timer_arg_t p)
typedef uint16_t | timer_hdl_t
## Functions
void | timer_get_tstamp (time_stamp_t *ts)
void | timer_init (void)
| Initialization of the timer module.
timer_hdl_t | timer_restart (timer_hdl_t th, time_t duration)
| Restarting a running timer.
void | timer_set_systime (time_t sec)
| Set the current system time given in seconds since 1.1.1970.
timer_hdl_t | timer_start (timer_handler_t *thfunc, time_t duration, timer_arg_t arg)
| Start a timer with a given handler function.
timer_hdl_t | timer_stop (timer_hdl_t th)
| Stop a running timer.
time_t | timer_systime (void)
| Return the current system time in ticks.

## Define Documentation

#define NONE_TIMER (0)

Symbolic name for invalid timer handle

Definition at line 104 of file timer.h.

## Function Documentation

void timer_get_tstamp | ( | time_stamp_t * | ts | ) |

Function that returns the internal system time counters as "libpcap" compatible time stamp.

Note:
  This routine takes ~548 cycles for execution. In case of a 8Mhz driven system, this is a 68.5 us.

Parameters:

  | ts | timestamp data structure