Tenok
A Linux-like Real-Time Operating System for Robotics and Internet of Things
time.h
Go to the documentation of this file.
1 
4 #ifndef __KERNEL_TIME_H__
5 #define __KERNEL_TIME_H__
6 
7 #include <stdbool.h>
8 #include <time.h>
9 
10 #include <common/list.h>
11 
12 typedef int64_t ktime_t;
13 
14 struct timer {
15  int id;
16  int flags;
17  bool enabled;
18  struct sigevent sev;
19  struct itimerspec setting;
20  struct itimerspec ret_time; /* For returning current time */
21  struct timespec counter; /* Internal countdown counter */
22  struct thread_info *thread; /* The thread that the timer belongs to */
23  struct list_head g_list; /* Linked to the global timer list */
24  struct list_head list; /* Linked to the thread timer list */
25 };
26 
27 void timer_up_count(struct timespec *time);
28 void timer_down_count(struct timespec *time);
29 void time_add(struct timespec *time, time_t sec, long nsec);
30 void get_sys_time(struct timespec *tp);
31 void set_sys_time(const struct timespec *tp);
32 void get_realtime(struct timespec *tp);
33 void set_realtime(const struct timespec *tp);
34 void system_timer_update(void);
35 
36 ktime_t ktime_get(void);
37 
38 #endif
Definition: time.h:21
Definition: list.h:111
Definition: signal.h:88
Definition: kernel.h:71
Definition: time.h:14
Definition: time.h:16
time_t time(time_t *tloc)
Return the time as the number of seconds since 1970-01-01 00:00:00 +0000 (UTC)
Definition: time.c:185