PageRenderTime 50ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/sysdeps/unix/sysv/linux/bits/time.h

https://gitlab.com/Namal/glibc
C Header | 101 lines | 44 code | 14 blank | 43 comment | 4 complexity | 387aee0fdf5a6d82302bd240b20b6e26 MD5 | raw file
  1. /* System-dependent timing definitions. Linux version.
  2. Copyright (C) 1996-2016 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. {
  26. __time_t tv_sec; /* Seconds. */
  27. __suseconds_t tv_usec; /* Microseconds. */
  28. };
  29. # endif /* struct timeval */
  30. #endif
  31. #ifndef __need_timeval
  32. # ifndef _BITS_TIME_H
  33. # define _BITS_TIME_H 1
  34. /* ISO/IEC 9899:1999 7.23.1: Components of time
  35. The macro `CLOCKS_PER_SEC' is an expression with type `clock_t' that is
  36. the number per second of the value returned by the `clock' function. */
  37. /* CAE XSH, Issue 4, Version 2: <time.h>
  38. The value of CLOCKS_PER_SEC is required to be 1 million on all
  39. XSI-conformant systems. */
  40. # define CLOCKS_PER_SEC ((clock_t) 1000000)
  41. # if (!defined __STRICT_ANSI__ || defined __USE_POSIX) \
  42. && !defined __USE_XOPEN2K
  43. /* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
  44. presents the real value for clock ticks per second for the system. */
  45. # include <bits/types.h>
  46. extern long int __sysconf (int);
  47. # define CLK_TCK ((__clock_t) __sysconf (2)) /* 2 is _SC_CLK_TCK */
  48. # endif
  49. # ifdef __USE_POSIX199309
  50. /* Identifier for system-wide realtime clock. */
  51. # define CLOCK_REALTIME 0
  52. /* Monotonic system-wide clock. */
  53. # define CLOCK_MONOTONIC 1
  54. /* High-resolution timer from the CPU. */
  55. # define CLOCK_PROCESS_CPUTIME_ID 2
  56. /* Thread-specific CPU-time clock. */
  57. # define CLOCK_THREAD_CPUTIME_ID 3
  58. /* Monotonic system-wide clock, not adjusted for frequency scaling. */
  59. # define CLOCK_MONOTONIC_RAW 4
  60. /* Identifier for system-wide realtime clock, updated only on ticks. */
  61. # define CLOCK_REALTIME_COARSE 5
  62. /* Monotonic system-wide clock, updated only on ticks. */
  63. # define CLOCK_MONOTONIC_COARSE 6
  64. /* Monotonic system-wide clock that includes time spent in suspension. */
  65. # define CLOCK_BOOTTIME 7
  66. /* Like CLOCK_REALTIME but also wakes suspended system. */
  67. # define CLOCK_REALTIME_ALARM 8
  68. /* Like CLOCK_BOOTTIME but also wakes suspended system. */
  69. # define CLOCK_BOOTTIME_ALARM 9
  70. /* Like CLOCK_REALTIME but in International Atomic Time. */
  71. # define CLOCK_TAI 11
  72. /* Flag to indicate time is absolute. */
  73. # define TIMER_ABSTIME 1
  74. # endif
  75. # ifdef __USE_GNU
  76. # include <bits/timex.h>
  77. __BEGIN_DECLS
  78. /* Tune a POSIX clock. */
  79. extern int clock_adjtime (__clockid_t __clock_id, struct timex *__utx) __THROW;
  80. __END_DECLS
  81. # endif /* use GNU */
  82. # endif /* bits/time.h */
  83. #endif
  84. #undef __need_timeval