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 <sys/types.h> 13 typedef long time_t; 14 15 /* 16 * Structure returned by gettimeofday(2) system call, 17 * and used in other calls. 18 */ 19 struct timeval { 20 long tv_sec; /* seconds */ 21 long tv_usec; /* and microseconds */ 22 }; 23 24 /* 25 * Structure defined by POSIX.1b to be like a timeval. 26 */ 27 struct timespec { 28 time_t tv_sec; /* seconds */ 29 long tv_nsec; /* and nanoseconds */ 30 }; 31 32 struct timezone { 33 int tz_minuteswest; /* minutes west of Greenwich */ 34 int tz_dsttime; /* type of dst correction */ 35 }; 36 37 struct tm { 38 int tm_sec; /* Seconds. [0-60] (1 leap second) */ 39 int tm_min; /* Minutes. [0-59] */ 40 int tm_hour; /* Hours. [0-23] */ 41 int tm_mday; /* Day. [1-31] */ 42 int tm_mon; /* Month. [0-11] */ 43 int tm_year; /* Year - 1900. */ 44 int tm_wday; /* Day of week. [0-6] */ 45 int tm_yday; /* Days in year.[0-365] */ 46 int tm_isdst; /* DST. [-1/0/1]*/ 47 48 long int tm_gmtoff; /* Seconds east of UTC. */ 49 const char *tm_zone; /* Timezone abbreviation. */ 50 }; 51 52 int gettimeofday(struct timeval *tp, void *ignore); 53 54 #endif 55