time.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. #define NFDBITS __NFDBITS
  20. #define FD_SETSIZE __FD_SETSIZE
  21. #define FD_SET(fd,fdsetp) __FD_SET(fd,fdsetp)
  22. #define FD_CLR(fd,fdsetp) __FD_CLR(fd,fdsetp)
  23. #define FD_ISSET(fd,fdsetp) __FD_ISSET(fd,fdsetp)
  24. #define FD_ZERO(fdsetp) __FD_ZERO(fdsetp)
  25. /*
  26. * Names of the interval timers, and structure
  27. * defining a timer setting:
  28. */
  29. #define ITIMER_REAL 0
  30. #define ITIMER_VIRTUAL 1
  31. #define ITIMER_PROF 2
  32. struct itimerspec {
  33. struct timespec it_interval; /* timer period */
  34. struct timespec it_value; /* timer expiration */
  35. };
  36. struct itimerval {
  37. struct timeval it_interval; /* timer interval */
  38. struct timeval it_value; /* current value */
  39. };
  40. /*
  41. * The IDs of the various system clocks (for POSIX.1b interval timers):
  42. */
  43. #define CLOCK_REALTIME 0
  44. #define CLOCK_MONOTONIC 1
  45. #define CLOCK_PROCESS_CPUTIME_ID 2
  46. #define CLOCK_THREAD_CPUTIME_ID 3
  47. #define CLOCK_MONOTONIC_RAW 4
  48. #define CLOCK_REALTIME_COARSE 5
  49. #define CLOCK_MONOTONIC_COARSE 6
  50. /*
  51. * The IDs of various hardware clocks:
  52. */
  53. #define CLOCK_SGI_CYCLE 10
  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