timex.h 1.8 KB

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