1
0

timex.h 3.5 KB

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