time.h 1.5 KB

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