time.h 1.2 KB

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