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 #ifndef _TIMESPEC_DEFINED 32 #define _TIMESPEC_DEFINED 33 /* 34 * Structure defined by POSIX.1b to be like a timeval. 35 */ 36 struct timespec { 37 time_t tv_sec; /* seconds */ 38 long tv_nsec; /* and nanoseconds */ 39 }; 40 #endif /* _TIMESPEC_DEFINED */ 41 42 struct timezone { 43 int tz_minuteswest; /* minutes west of Greenwich */ 44 int tz_dsttime; /* type of dst correction */ 45 }; 46 47 int gettimeofday(struct timeval *tp, void *ignore); 48 struct tm *gmtime_r(const time_t *timep, struct tm *r); 49 50 #ifdef __cplusplus 51 } 52 #endif 53 54 #endif /* _SYS_TIME_H_ */ 55