POK
time.h
1 /*
2  * POK header
3  *
4  * The following file is a part of the POK project. Any modification should
5  * made according to the POK licence. You CANNOT use this file or a part of
6  * this file is this part of a file for your own project
7  *
8  * For more information on the POK licence, please see our LICENCE FILE
9  *
10  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
11  *
12  * Copyright (c) 2007-2009 POK team
13  *
14  * Created by julien on Thu Jan 15 23:34:13 2009
15  */
16 
17 
18 #ifndef __POK_TIME_H__
19 #define __POK_TIME_H__
20 
21 #include <core/dependencies.h>
22 
23 #include <types.h>
24 #include <errno.h>
25 #include <core/syscall.h>
26 
27 #define pok_time_get(v) pok_time_gettick(v)
28 /*
29  * Get the amount of milliseconds expired since the system starts.
30  */
31 
32 #define pok_time_milliseconds(value) value
33 /*
34  * Build a time according to the amount of time given in the first
35  * parameter
36  * Similar to: pok_time_t pok_time_milliseconds (const uint32_t ms);
37  */
38 
39 #define pok_time_seconds(s) s*1000;
40 /*
41  * Build a time value according to the time given in the first
42  * parameter
43  * Could be considered as: pok_time_t pok_time_seconds (const uint32_t s);
44  */
45 
46 pok_ret_t pok_time_compute_deadline (const pok_time_t relative, pok_time_t* absolute);
47 /*
48  * Compute a deadline from now according to the first parameter.
49  * This function is a facility to compute tasks' deadline.
50  */
51 
52 #define pok_time_gettick(value) pok_syscall2(POK_SYSCALL_GETTICK,(uint32_t)value,0);
53 /*
54  * Get number of ticks that passed since the system starts
55  * Similar to : pok_ret_t pok_time_gettick (uint64_t* value);
56  */
57 
58 #endif /* __POK_TIME_H__ */