time.h 1.2 KB

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