time.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* System-dependent timing definitions. Linux version.
  2. Copyright (C) 1996-2014 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. #ifndef __need_timeval
  19. # ifndef _BITS_TIME_H
  20. # define _BITS_TIME_H 1
  21. /* ISO/IEC 9899:1990 7.12.1: <time.h>
  22. The macro `CLOCKS_PER_SEC' is the number per second of the value
  23. returned by the `clock' function. */
  24. /* CAE XSH, Issue 4, Version 2: <time.h>
  25. The value of CLOCKS_PER_SEC is required to be 1 million on all
  26. XSI-conformant systems. */
  27. # define CLOCKS_PER_SEC 1000000l
  28. /* Get the arch-specific value of __UCLIBC_CLK_TCK_CONST used for CLK_TCK
  29. * in sysconf() and clock(). */
  30. #include <bits/uClibc_clk_tck.h>
  31. # if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K
  32. /* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
  33. presents the real value for clock ticks per second for the system. */
  34. # include <bits/types.h>
  35. /* Note (uClibc): glibc #defines CLK_TCK as a sysconf() call. */
  36. # define CLK_TCK ((__clock_t) __UCLIBC_CLK_TCK_CONST)
  37. # endif
  38. # ifdef __USE_POSIX199309
  39. /* Identifier for system-wide realtime clock. */
  40. # define CLOCK_REALTIME 0
  41. /* Monotonic system-wide clock. */
  42. # define CLOCK_MONOTONIC 1
  43. /* High-resolution timer from the CPU. */
  44. # define CLOCK_PROCESS_CPUTIME_ID 2
  45. /* Thread-specific CPU-time clock. */
  46. # define CLOCK_THREAD_CPUTIME_ID 3
  47. /* Monotonic system-wide clock, not adjusted for frequency scaling. */
  48. # define CLOCK_MONOTONIC_RAW 4
  49. /* Identifier for system-wide realtime clock, updated only on ticks. */
  50. # define CLOCK_REALTIME_COARSE 5
  51. /* Monotonic system-wide clock, updated only on ticks. */
  52. # define CLOCK_MONOTONIC_COARSE 6
  53. /* Monotonic system-wide clock that includes time spent in suspension. */
  54. # define CLOCK_BOOTTIME 7
  55. /* Like CLOCK_REALTIME but also wakes suspended system. */
  56. # define CLOCK_REALTIME_ALARM 8
  57. /* Like CLOCK_BOOTTIME but also wakes suspended system. */
  58. # define CLOCK_BOOTTIME_ALARM 9
  59. /* Like CLOCK_REALTIME but in International Atomic Time. */
  60. # define CLOCK_TAI 11
  61. /* Flag to indicate time is absolute. */
  62. # define TIMER_ABSTIME 1
  63. # endif
  64. # endif /* bits/time.h */
  65. #endif
  66. #ifdef __need_timeval
  67. # undef __need_timeval
  68. # ifndef _STRUCT_TIMEVAL
  69. # define _STRUCT_TIMEVAL 1
  70. # include <bits/types.h>
  71. /* A time value that is accurate to the nearest
  72. microsecond but also has a range of years. */
  73. struct timeval
  74. {
  75. __time_t tv_sec; /* Seconds. */
  76. __suseconds_t tv_usec; /* Microseconds. */
  77. };
  78. # endif /* struct timeval */
  79. #endif /* need timeval */