time.h 1.3 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. * 2020-09-07 Meco Man combine gcc armcc iccarm
  9. */
  10. #ifndef _SYS_TIME_H_
  11. #define _SYS_TIME_H_
  12. #include <time.h>
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. /*
  17. * Skip define timespec for IAR version over 8.10.1 where __VER__ is 8010001.
  18. */
  19. #if defined ( __ICCARM__ ) && (__VER__ >= 8010001)
  20. #define _TIMESPEC_DEFINED
  21. #endif
  22. #ifndef _TIMEVAL_DEFINED
  23. #define _TIMEVAL_DEFINED
  24. /*
  25. * Structure returned by gettimeofday(2) system call,
  26. * and used in other calls.
  27. */
  28. struct timeval {
  29. long tv_sec; /* seconds */
  30. long tv_usec; /* and microseconds */
  31. };
  32. #endif /* _TIMEVAL_DEFINED */
  33. #if !defined __GNUC__ && !defined __ICCARM__
  34. struct timespec {
  35. time_t tv_sec; /* seconds */
  36. long tv_nsec; /* and nanoseconds */
  37. };
  38. #endif
  39. struct timezone {
  40. int tz_minuteswest; /* minutes west of Greenwich */
  41. int tz_dsttime; /* type of dst correction */
  42. };
  43. int stime(const time_t *t);
  44. time_t timegm(struct tm * const t);
  45. int gettimeofday(struct timeval *tv, struct timezone *tz);
  46. int settimeofday(const struct timeval *tv, const struct timezone *tz);
  47. #ifdef __cplusplus
  48. }
  49. #endif
  50. #endif /* _SYS_TIME_H_ */