time.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef _UAPI_LINUX_TIME_H
  3. #define _UAPI_LINUX_TIME_H
  4. #include <linux/types.h>
  5. #ifndef _STRUCT_TIMESPEC
  6. #define _STRUCT_TIMESPEC
  7. struct timespec {
  8. __kernel_time_t tv_sec; /* seconds */
  9. long tv_nsec; /* nanoseconds */
  10. };
  11. #endif
  12. struct timeval {
  13. __kernel_time_t tv_sec; /* seconds */
  14. __kernel_suseconds_t tv_usec; /* microseconds */
  15. };
  16. struct timezone {
  17. int tz_minuteswest; /* minutes west of Greenwich */
  18. int tz_dsttime; /* type of dst correction */
  19. };
  20. /*
  21. * Names of the interval timers, and structure
  22. * defining a timer setting:
  23. */
  24. #define ITIMER_REAL 0
  25. #define ITIMER_VIRTUAL 1
  26. #define ITIMER_PROF 2
  27. struct itimerspec {
  28. struct timespec it_interval; /* timer period */
  29. struct timespec it_value; /* timer expiration */
  30. };
  31. struct itimerval {
  32. struct timeval it_interval; /* timer interval */
  33. struct timeval it_value; /* current value */
  34. };
  35. /*
  36. * The IDs of the various system clocks (for POSIX.1b interval timers):
  37. */
  38. #define CLOCK_REALTIME 0
  39. #define CLOCK_MONOTONIC 1
  40. #define CLOCK_PROCESS_CPUTIME_ID 2
  41. #define CLOCK_THREAD_CPUTIME_ID 3
  42. #define CLOCK_MONOTONIC_RAW 4
  43. #define CLOCK_REALTIME_COARSE 5
  44. #define CLOCK_MONOTONIC_COARSE 6
  45. #define CLOCK_BOOTTIME 7
  46. #define CLOCK_REALTIME_ALARM 8
  47. #define CLOCK_BOOTTIME_ALARM 9
  48. /*
  49. * The driver implementing this got removed. The clock ID is kept as a
  50. * place holder. Do not reuse!
  51. */
  52. #define CLOCK_SGI_CYCLE 10
  53. #define CLOCK_TAI 11
  54. #define MAX_CLOCKS 16
  55. #define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC)
  56. #define CLOCKS_MONO CLOCK_MONOTONIC
  57. /*
  58. * The various flags for setting POSIX.1b interval timers:
  59. */
  60. #define TIMER_ABSTIME 0x01
  61. #endif /* _UAPI_LINUX_TIME_H */