1 /*
2  * Copyright (C) 2015-2017 Alibaba Group Holding Limited
3  */
4 
5 #ifndef _SYS_TIME_H_
6 #define _SYS_TIME_H_
7 
8 #include <time.h>
9 #include <sys/types.h>
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 #ifndef _TIMEVAL_DEFINED
16 #define _TIMEVAL_DEFINED
17 /*
18  * Structure returned by gettimeofday(2) system call,
19  * and used in other calls.
20  */
21 struct timeval {
22     long    tv_sec;     /* seconds */
23     long    tv_usec;    /* and microseconds */
24 };
25 #endif /* _TIMEVAL_DEFINED */
26 
27 #ifndef _TIMESPEC_DEFINED
28 #define _TIMESPEC_DEFINED
29 /*
30  * Structure defined by POSIX.1b to be like a timeval.
31  */
32 struct timespec {
33     time_t  tv_sec;     /* seconds */
34     long    tv_nsec;    /* and nanoseconds */
35 };
36 #endif /* _TIMESPEC_DEFINED */
37 
38 struct timezone {
39   int tz_minuteswest;   /* minutes west of Greenwich */
40   int tz_dsttime;       /* type of dst correction */
41 };
42 
43 int gettimeofday(struct timeval *tp, void *ignore);
44 
45 #ifdef __cplusplus
46 }
47 #endif
48 
49 #endif /* _SYS_TIME_H_ */
50