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 
23 #include "core/itimer.h"
24 
25 #include "core/time.h"
26 
27 #include "sys/types.h"
28 
29 /* Helpers and local definitions */
30 
34 #define NUM_SECONDS_IN_MIN (60)
35 
39 #define NUM_MILLIS_IN_SEC (1000)
40 
44 #define NUM_NANOS_IN_USEC (1000)
45 
49 #define NUM_NANOS_IN_MILLI (1000000L)
50 
54 #define NUM_NANOS_IN_SEC (1000000000ULL)
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
62 struct tm
63 {
64  int tm_sec;
65  int tm_min;
66  int tm_hour;
67  int tm_mday;
68  int tm_mon;
69  int tm_year;
70  int tm_wday;
71  int tm_yday;
72  int tm_isdst;
73 };
74 
75 
103 int nanosleep(const struct timespec *req, struct timespec *rem);
104 
115 int clock_gettime(clockid_t clk_id, struct timespec *ts);
116 
123 
125 #ifndef __HIDE_INTERNAL_FUNCTIONS__
126 
132 int alarm(unsigned int seconds);
133 
146 int setitimer(int which, const struct itimerval *new_value,
147  struct itimerval *old_value);
148 
159 int getitimer(int which, struct itimerval *curr_value);
160 
161 #endif /* __HIDE_INTERNAL_FUNCTIONS__ */
162 
168 unsigned int arm_timer_get_frequency(void);
169 
176 void timeadd(const struct timespec *a,
177  const struct timespec *b,
178  struct timespec *res);
179 
186 void timesub(const struct timespec *a,
187  const struct timespec *b,
188  struct timespec *res);
189 
196 int64_t timespec_to_ms(const struct timespec *a);
197 
204 uint64_t timespec_to_nsec(const struct timespec *a);
205 
212 void ms_to_timespec(int64_t t, struct timespec *a);
213 
214 #ifdef __cplusplus
215 }
216 #endif
217 
218 #endif
219 
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:67
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:66
long long time_t
Definition: types.h:33
int tm_mon
Definition: time.h:68
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:64
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:70
int tm_min
Definition: time.h:65
Definition: time.h:62
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:72
int tm_yday
Definition: time.h:71
int tm_year
Definition: time.h:69