/v2/headers/linux_amd64/usr/include/bits/time.h

https://github.com/cznic/cc · C Header · 97 lines · 43 code · 11 blank · 43 comment · 4 complexity · 42c767777709709fdfd3b6749314c5c3 MD5 · raw file

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