xref: /nrf52832-nimble/rt-thread/components/libc/compilers/dlib/sys/time.h (revision 042d53a763ad75cb1465103098bb88c245d95138)
1 /*
2  * Copyright (c) 2006-2018, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  */
9 #ifndef _SYS_TIME_H_
10 #define _SYS_TIME_H_
11 
12 #include <time.h>
13 #include <sys/types.h>
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 #ifndef _TIMEVAL_DEFINED
20 #define _TIMEVAL_DEFINED
21 /*
22  * Structure returned by gettimeofday(2) system call,
23  * and used in other calls.
24  */
25 struct timeval {
26     long    tv_sec;     /* seconds */
27     long    tv_usec;    /* and microseconds */
28 };
29 #endif /* _TIMEVAL_DEFINED */
30 
31 /*
32  * Skip define timespec for IAR version over 8.10.1 where __VER__ is 8010001.
33  */
34 #if defined ( __ICCARM__ ) && (__VER__ >= 8010001)
35 #define _TIMESPEC_DEFINED
36 #endif
37 
38 #ifndef _TIMESPEC_DEFINED
39 #define _TIMESPEC_DEFINED
40 /*
41  * Structure defined by POSIX.1b to be like a timeval.
42  */
43 struct timespec {
44     time_t  tv_sec;     /* seconds */
45     long    tv_nsec;    /* and nanoseconds */
46 };
47 #endif /* _TIMESPEC_DEFINED */
48 
49 struct timezone {
50   int tz_minuteswest;   /* minutes west of Greenwich */
51   int tz_dsttime;       /* type of dst correction */
52 };
53 
54 int gettimeofday(struct timeval *tp, void *ignore);
55 struct tm *gmtime_r(const time_t *timep, struct tm *r);
56 
57 #ifdef __cplusplus
58 }
59 #endif
60 
61 #endif /* _SYS_TIME_H_ */
62