1
0

time.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. /* System-dependent timing definitions. Linux version.
  17. Copyright (C) 1996-2026 Free Software Foundation, Inc.
  18. This file is part of the GNU C Library.
  19. The GNU C Library is free software; you can redistribute it and/or
  20. modify it under the terms of the GNU Lesser General Public
  21. License as published by the Free Software Foundation; either
  22. version 2.1 of the License, or (at your option) any later version.
  23. The GNU C Library is distributed in the hope that it will be useful,
  24. but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  26. Lesser General Public License for more details.
  27. You should have received a copy of the GNU Lesser General Public
  28. License along with the GNU C Library; if not, see
  29. <https://www.gnu.org/licenses/>. */
  30. /*
  31. * Never include this file directly; use <time.h> instead.
  32. */
  33. #ifndef _BITS_TIME_H
  34. #define _BITS_TIME_H 1
  35. #include <bits/types.h>
  36. /* ISO/IEC 9899:1999 7.23.1: Components of time
  37. The macro `CLOCKS_PER_SEC' is an expression with type `clock_t' that is
  38. the number per second of the value returned by the `clock' function. */
  39. /* CAE XSH, Issue 4, Version 2: <time.h>
  40. The value of CLOCKS_PER_SEC is required to be 1 million on all
  41. XSI-conformant systems. */
  42. #define CLOCKS_PER_SEC ((__clock_t) 1000000)
  43. #if (!defined __STRICT_ANSI__ || defined __USE_POSIX) \
  44. && !defined __USE_XOPEN2K
  45. /* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
  46. presents the real value for clock ticks per second for the system. */
  47. extern long int __sysconf (int);
  48. # define CLK_TCK ((__clock_t) __sysconf (2)) /* 2 is _SC_CLK_TCK */
  49. #endif
  50. #ifdef __USE_POSIX199309
  51. /* Identifier for system-wide realtime clock. */
  52. # define CLOCK_REALTIME 0
  53. /* Monotonic system-wide clock. */
  54. # define CLOCK_MONOTONIC 1
  55. /* High-resolution timer from the CPU. */
  56. # define CLOCK_PROCESS_CPUTIME_ID 2
  57. /* Thread-specific CPU-time clock. */
  58. # define CLOCK_THREAD_CPUTIME_ID 3
  59. /* Monotonic system-wide clock, not adjusted for frequency scaling. */
  60. # define CLOCK_MONOTONIC_RAW 4
  61. /* Identifier for system-wide realtime clock, updated only on ticks. */
  62. # define CLOCK_REALTIME_COARSE 5
  63. /* Monotonic system-wide clock, updated only on ticks. */
  64. # define CLOCK_MONOTONIC_COARSE 6
  65. /* Monotonic system-wide clock that includes time spent in suspension. */
  66. # define CLOCK_BOOTTIME 7
  67. /* Like CLOCK_REALTIME but also wakes suspended system. */
  68. # define CLOCK_REALTIME_ALARM 8
  69. /* Like CLOCK_BOOTTIME but also wakes suspended system. */
  70. # define CLOCK_BOOTTIME_ALARM 9
  71. /* Like CLOCK_REALTIME but in International Atomic Time. */
  72. # define CLOCK_TAI 11
  73. /* Flag to indicate time is absolute. */
  74. # define TIMER_ABSTIME 1
  75. #endif
  76. #ifdef __USE_GNU
  77. # include <bits/timex.h>
  78. __BEGIN_DECLS
  79. /* Tune a POSIX clock. */
  80. extern int clock_adjtime (__clockid_t __clock_id, struct timex *__utx) __THROW __nonnull((2));
  81. #ifdef __USE_TIME64_REDIRECTS
  82. # if defined(__REDIRECT_NTH)
  83. extern int __REDIRECT_NTH (clock_adjtime, (__clockid_t __clock_id,
  84. struct timex *__utx),
  85. __clock_adjtime64) __nonnull((2));
  86. # else
  87. # define clock_adjtime __clock_adjtime64
  88. # endif
  89. #endif
  90. __END_DECLS
  91. #endif /* use GNU */
  92. #endif /* bits/time.h */