time.h 2.1 KB

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