Samsung Internal API reference  2.0
time.h
Go to the documentation of this file.
1 
9 #ifndef __SERI_TIME_H__
10 #define __SERI_TIME_H__
11 
12 #include "core/time.h"
13 
14 #include "sys/types.h"
15 
16 /* Helpers and local definitions */
17 
21 #define NUM_SECONDS_IN_MIN (60)
22 
26 #define NUM_MILLIS_IN_SEC (1000)
27 
31 #define NUM_NANOS_IN_USEC (1000)
32 
36 #define NUM_NANOS_IN_MILLI (1000000L)
37 
41 #define NUM_NANOS_IN_SEC (1000000000ULL)
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
49 struct tm
50 {
51  int tm_sec;
52  int tm_min;
53  int tm_hour;
54  int tm_mday;
55  int tm_mon;
56  int tm_year;
57  int tm_wday;
58  int tm_yday;
59  int tm_isdst;
60 };
61 
62 
90 int nanosleep(const struct timespec *req, struct timespec *rem);
91 
102 int clock_gettime(clockid_t clk_id, struct timespec *ts);
103 
110 
112 #ifndef __HIDE_INTERNAL_FUNCTIONS__
113 
119 int alarm(unsigned int seconds);
120 
121 #endif /* __HIDE_INTERNAL_FUNCTIONS__ */
122 
128 unsigned int arm_timer_get_frequency(void);
129 
136 void timeadd(const struct timespec *a,
137  const struct timespec *b,
138  struct timespec *res);
139 
146 void timesub(const struct timespec *a,
147  const struct timespec *b,
148  struct timespec *res);
149 
156 int64_t timespec_to_ms(const struct timespec *a);
157 
164 uint64_t timespec_to_nsec(const struct timespec *a);
165 
172 void ms_to_timespec(int64_t t, struct timespec *a);
173 
174 #ifdef __cplusplus
175 }
176 #endif
177 
178 #endif
179 
void timeadd(const struct timespec *a, const struct timespec *b, struct timespec *res)
The function adds two dates.
uint64_t timespec_to_nsec(const struct timespec *a)
The function converts time from timespec format to nanoseconds.
int tm_mday
Definition: time.h:54
Wrapper for kernel types.h header.
void ms_to_timespec(int64_t t, struct timespec *a)
The function converts time in milliseconds to to timespec format.
int tm_hour
Definition: time.h:53
long long time_t
Definition: types.h:33
int tm_mon
Definition: time.h:55
int clock_gettime(clockid_t clk_id, struct timespec *ts)
The function retrieves the time of the specified clock clk_id. This function is non-blocking, except CLOCK_REE case. In this case function can sleep and can be interrupted with -1 result and EINTR errno.
int nanosleep(const struct timespec *req, struct timespec *rem)
nanosleep() suspends the execution of the calling thread until either at least the time specified in ...
int tm_sec
Definition: time.h:51
void timesub(const struct timespec *a, const struct timespec *b, struct timespec *res)
The function subtracts two dates.
unsigned int arm_timer_get_frequency(void)
The function retrieves the frequency of ARM timer.
int tm_wday
Definition: time.h:57
int tm_min
Definition: time.h:52
Definition: time.h:49
int64_t timespec_to_ms(const struct timespec *a)
The function converts time from timespec format to milliseconds.
time_t time(time_t *time)
Get the current calendar time as a value of type time_t.
int tm_isdst
Definition: time.h:59
int tm_yday
Definition: time.h:58
int tm_year
Definition: time.h:56