blob: 630c8ba420172cc4c2e6655e82cb8280d305dbb0 [file] [log] [blame]
Paul Bakker5121ce52009-01-03 21:22:43 +00001/**
2 * \file timing.h
3 */
Paul Bakker40e46942009-01-03 21:51:57 +00004#ifndef POLARSSL_TIMING_H
5#define POLARSSL_TIMING_H
Paul Bakker5121ce52009-01-03 21:22:43 +00006
7/**
8 * \brief timer structure
9 */
10struct hr_time
11{
12 unsigned char opaque[32];
13};
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19extern int alarmed;
20
21/**
22 * \brief Return the CPU cycle counter value
23 */
24unsigned long hardclock( void );
25
26/**
27 * \brief Return the elapsed time in milliseconds
28 *
29 * \param val points to a timer structure
30 * \param reset if set to 1, the timer is restarted
31 */
32unsigned long get_timer( struct hr_time *val, int reset );
33
34/**
35 * \brief Setup an alarm clock
36 *
37 * \param seconds delay before the "alarmed" flag is set
38 */
39void set_alarm( int seconds );
40
41/**
42 * \brief Sleep for a certain amount of time
43 */
44void m_sleep( int milliseconds );
45
46#ifdef __cplusplus
47}
48#endif
49
50#endif /* timing.h */