1
0

timex.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #ifndef _SYS_TIMEX_H
  2. #define _SYS_TIMEX_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #define __NEED_clockid_t
  7. #include <bits/alltypes.h>
  8. #include <sys/time.h>
  9. struct ntptimeval {
  10. struct timeval time;
  11. long maxerror, esterror;
  12. };
  13. struct timex {
  14. unsigned modes;
  15. long offset, freq, maxerror, esterror;
  16. int status;
  17. long constant, precision, tolerance;
  18. struct timeval time;
  19. long tick, ppsfreq, jitter;
  20. int shift;
  21. long stabil, jitcnt, calcnt, errcnt, stbcnt;
  22. int tai;
  23. int __padding[11];
  24. };
  25. #define ADJ_OFFSET 0x0001
  26. #define ADJ_FREQUENCY 0x0002
  27. #define ADJ_MAXERROR 0x0004
  28. #define ADJ_ESTERROR 0x0008
  29. #define ADJ_STATUS 0x0010
  30. #define ADJ_TIMECONST 0x0020
  31. #define ADJ_TAI 0x0080
  32. #define ADJ_SETOFFSET 0x0100
  33. #define ADJ_MICRO 0x1000
  34. #define ADJ_NANO 0x2000
  35. #define ADJ_TICK 0x4000
  36. #define ADJ_OFFSET_SINGLESHOT 0x8001
  37. #define ADJ_OFFSET_SS_READ 0xa001
  38. #define MOD_OFFSET ADJ_OFFSET
  39. #define MOD_FREQUENCY ADJ_FREQUENCY
  40. #define MOD_MAXERROR ADJ_MAXERROR
  41. #define MOD_ESTERROR ADJ_ESTERROR
  42. #define MOD_STATUS ADJ_STATUS
  43. #define MOD_TIMECONST ADJ_TIMECONST
  44. #define MOD_CLKB ADJ_TICK
  45. #define MOD_CLKA ADJ_OFFSET_SINGLESHOT
  46. #define MOD_TAI ADJ_TAI
  47. #define MOD_MICRO ADJ_MICRO
  48. #define MOD_NANO ADJ_NANO
  49. #define STA_PLL 0x0001
  50. #define STA_PPSFREQ 0x0002
  51. #define STA_PPSTIME 0x0004
  52. #define STA_FLL 0x0008
  53. #define STA_INS 0x0010
  54. #define STA_DEL 0x0020
  55. #define STA_UNSYNC 0x0040
  56. #define STA_FREQHOLD 0x0080
  57. #define STA_PPSSIGNAL 0x0100
  58. #define STA_PPSJITTER 0x0200
  59. #define STA_PPSWANDER 0x0400
  60. #define STA_PPSERROR 0x0800
  61. #define STA_CLOCKERR 0x1000
  62. #define STA_NANO 0x2000
  63. #define STA_MODE 0x4000
  64. #define STA_CLK 0x8000
  65. #define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
  66. STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
  67. #define TIME_OK 0
  68. #define TIME_INS 1
  69. #define TIME_DEL 2
  70. #define TIME_OOP 3
  71. #define TIME_WAIT 4
  72. #define TIME_ERROR 5
  73. #define TIME_BAD TIME_ERROR
  74. #define MAXTC 6
  75. int adjtimex(struct timex *);
  76. int clock_adjtime(clockid_t, struct timex *);
  77. #if _REDIR_TIME64
  78. __REDIR(adjtimex, __adjtimex_time64);
  79. __REDIR(clock_adjtime, __clock_adjtime64);
  80. #endif
  81. #ifdef __cplusplus
  82. }
  83. #endif
  84. #endif