time.h 960 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* Wall-clock time for ring-3 commands (UTC only). */
  2. #ifndef LIBC_TIME_H
  3. #define LIBC_TIME_H
  4. #include <stddef.h>
  5. #include <sys/types.h>
  6. struct tm {
  7. int tm_sec;
  8. int tm_min;
  9. int tm_hour;
  10. int tm_mday;
  11. int tm_mon;
  12. int tm_year;
  13. int tm_wday;
  14. int tm_yday;
  15. int tm_isdst;
  16. };
  17. #define CLOCKS_PER_SEC 1000
  18. typedef long clock_t;
  19. #define CLOCK_REALTIME 0
  20. #define CLOCK_MONOTONIC 1
  21. struct timespec {
  22. time_t tv_sec;
  23. long tv_nsec;
  24. };
  25. time_t time(time_t *tloc);
  26. struct tm *gmtime(const time_t *timer);
  27. struct tm *localtime(const time_t *timer);
  28. time_t mktime(struct tm *tm);
  29. size_t strftime(char *s, size_t max, const char *format,
  30. const struct tm *tm);
  31. char *ctime(const time_t *timer);
  32. char *asctime(const struct tm *tm);
  33. double difftime(time_t time1, time_t time0);
  34. int clock_gettime(int clock_id, struct timespec *tp);
  35. int clock_settime(int clock_id, const struct timespec *tp);
  36. int nanosleep(const struct timespec *req, struct timespec *rem);
  37. #endif