time.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. #ifndef __kernel_timespec
  36. struct __kernel_timespec {
  37. __kernel_time64_t tv_sec; /* seconds */
  38. long long tv_nsec; /* nanoseconds */
  39. };
  40. #endif
  41. #ifndef __kernel_itimerspec
  42. struct __kernel_itimerspec {
  43. struct __kernel_timespec it_interval; /* timer period */
  44. struct __kernel_timespec it_value; /* timer expiration */
  45. };
  46. #endif
  47. /*
  48. * legacy timeval structure, only embedded in structures that
  49. * traditionally used 'timeval' to pass time intervals (not absolute
  50. * times). Do not add new users. If user space fails to compile
  51. * here, this is probably because it is not y2038 safe and needs to
  52. * be changed to use another interface.
  53. */
  54. struct __kernel_old_timeval {
  55. __kernel_long_t tv_sec;
  56. __kernel_long_t tv_usec;
  57. };
  58. /*
  59. * The IDs of the various system clocks (for POSIX.1b interval timers):
  60. */
  61. #define CLOCK_REALTIME 0
  62. #define CLOCK_MONOTONIC 1
  63. #define CLOCK_PROCESS_CPUTIME_ID 2
  64. #define CLOCK_THREAD_CPUTIME_ID 3
  65. #define CLOCK_MONOTONIC_RAW 4
  66. #define CLOCK_REALTIME_COARSE 5
  67. #define CLOCK_MONOTONIC_COARSE 6
  68. #define CLOCK_BOOTTIME 7
  69. #define CLOCK_REALTIME_ALARM 8
  70. #define CLOCK_BOOTTIME_ALARM 9
  71. /*
  72. * The driver implementing this got removed. The clock ID is kept as a
  73. * place holder. Do not reuse!
  74. */
  75. #define CLOCK_SGI_CYCLE 10
  76. #define CLOCK_TAI 11
  77. #define MAX_CLOCKS 16
  78. #define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC)
  79. #define CLOCKS_MONO CLOCK_MONOTONIC
  80. /*
  81. * The various flags for setting POSIX.1b interval timers:
  82. */
  83. #define TIMER_ABSTIME 0x01
  84. #endif /* _UAPI_LINUX_TIME_H */