timex.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* Copyright (C) 1995-2026 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, see
  13. <https://www.gnu.org/licenses/>. */
  14. #ifndef _SYS_TIMEX_H
  15. #define _SYS_TIMEX_H 1
  16. #include <features.h>
  17. #include <sys/time.h>
  18. /* These definitions from linux/timex.h as of 2.6.30. */
  19. #include <bits/timex.h>
  20. #define NTP_API 4 /* NTP API version */
  21. struct ntptimeval
  22. {
  23. struct timeval time; /* current time (ro) */
  24. long int maxerror; /* maximum error (us) (ro) */
  25. long int esterror; /* estimated error (us) (ro) */
  26. long int tai; /* TAI offset (ro) */
  27. long int __glibc_reserved1;
  28. long int __glibc_reserved2;
  29. long int __glibc_reserved3;
  30. long int __glibc_reserved4;
  31. };
  32. /* Clock states (time_state) */
  33. #define TIME_OK 0 /* clock synchronized, no leap second */
  34. #define TIME_INS 1 /* insert leap second */
  35. #define TIME_DEL 2 /* delete leap second */
  36. #define TIME_OOP 3 /* leap second in progress */
  37. #define TIME_WAIT 4 /* leap second has occurred */
  38. #define TIME_ERROR 5 /* clock not synchronized */
  39. #define TIME_BAD TIME_ERROR /* bw compat */
  40. /* Maximum time constant of the PLL. */
  41. #define MAXTC 6
  42. __BEGIN_DECLS
  43. #ifndef __USE_TIME64_REDIRECTS
  44. extern int adjtimex (struct timex *__ntx) __THROW __nonnull ((1));
  45. extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW __nonnull ((1));
  46. # ifdef __REDIRECT_NTH
  47. extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv),
  48. ntp_gettimex) __nonnull ((1));
  49. # else
  50. # define ntp_gettime ntp_gettimex
  51. # endif
  52. extern int ntp_adjtime (struct timex *__tntx) __THROW __nonnull ((1));
  53. #else
  54. # ifdef __REDIRECT_NTH
  55. extern int __REDIRECT_NTH (adjtimex, (struct timex *__ntx),
  56. ___adjtimex64) __nonnull ((1));
  57. extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv),
  58. __ntp_gettime64) __nonnull ((1));
  59. extern int __REDIRECT_NTH (ntp_gettimex, (struct ntptimeval *__ntv),
  60. __ntp_gettimex64) __nonnull ((1));
  61. extern int __REDIRECT_NTH (ntp_adjtime, (struct timex *__ntx),
  62. ___adjtimex64) __nonnull ((1));
  63. # else
  64. # define adjtimex ___adjtimex64
  65. # define ntp_adjtime ___adjtimex64
  66. # define ntp_gettime __ntp_gettime64
  67. # define ntp_gettimex __ntp_gettimex64
  68. # endif
  69. #endif
  70. __END_DECLS
  71. #endif /* sys/timex.h */