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 __TIME_H__
5 #define __TIME_H__
6 
7 #include <signal.h>
8 #include <stdint.h>
9 #include <sys/types.h>
10 
11 #define CLOCK_REALTIME 0
12 #define CLOCK_MONOTONIC 1
13 
14 struct timespec {
15  time_t tv_sec; /* Seconds */
16  long tv_nsec; /* Nanoseconds */
17 };
18 
19 struct itimerspec {
20  struct timespec it_value;
21  struct timespec it_interval;
22 };
23 
30 int clock_getres(clockid_t clockid, struct timespec *res);
31 
38 int clock_gettime(clockid_t clockid, struct timespec *tp);
39 
46 int clock_settime(clockid_t clockid, const struct timespec *tp);
47 
55 int timer_create(clockid_t clockid, struct sigevent *sevp, timer_t *timerid);
56 
62 int timer_delete(timer_t timerid);
63 
73 int timer_settime(timer_t timerid,
74  int flags,
75  const struct itimerspec *new_value,
76  struct itimerspec *old_value);
77 
84 int timer_gettime(timer_t timerid, struct itimerspec *curr_value);
85 
86 #endif
Definition: time.h:19
Definition: signal.h:47
Definition: time.h:14
int timer_settime(timer_t timerid, int flags, const struct itimerspec *new_value, struct itimerspec *old_value)
Arm or disarm the timer specified by the timer ID.
Definition: time.c:94
int clock_settime(clockid_t clockid, const struct timespec *tp)
Set the time of the specified clock ID.
Definition: time.c:77
int timer_create(clockid_t clockid, struct sigevent *sevp, timer_t *timerid)
Create a new per-thread interval timer.
Definition: time.c:82
int clock_getres(clockid_t clockid, struct timespec *res)
Get the resolution (precision) of the specified clock ID.
Definition: time.c:62
int timer_gettime(timer_t timerid, struct itimerspec *curr_value)
Return the timer interval and the time until next expiration.
Definition: time.c:102
int clock_gettime(clockid_t clockid, struct timespec *tp)
Retrieve the time of the specified clock ID.
Definition: time.c:72
int timer_delete(timer_t timerid)
Delete the timer specified with the timer ID.
Definition: time.c:89