time.h 1.2 KB

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