time.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (c) 2006-2021, 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 <time.h>
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. /*
  16. * Skip define timespec for IAR version over 8.10.1 where __VER__ is 8010001.
  17. */
  18. #if defined ( __ICCARM__ ) && (__VER__ >= 8010001)
  19. #define _TIMESPEC_DEFINED
  20. #endif
  21. #ifndef _TIMEVAL_DEFINED
  22. #define _TIMEVAL_DEFINED
  23. /*
  24. * Structure returned by gettimeofday(2) system call,
  25. * and used in other calls.
  26. */
  27. struct timeval {
  28. long tv_sec; /* seconds */
  29. long tv_usec; /* and microseconds */
  30. };
  31. #endif /* _TIMEVAL_DEFINED */
  32. #if !defined __GNUC__ && !defined __ICCARM__
  33. struct timespec {
  34. time_t tv_sec; /* seconds */
  35. long tv_nsec; /* and nanoseconds */
  36. };
  37. #endif
  38. struct timezone {
  39. int tz_minuteswest; /* minutes west of Greenwich */
  40. int tz_dsttime; /* type of dst correction */
  41. };
  42. int gettimeofday(struct timeval *tp, void *ignore);
  43. struct tm *gmtime_r(const time_t *timep, struct tm *r);
  44. #ifdef __cplusplus
  45. }
  46. #endif
  47. #endif /* _SYS_TIME_H_ */