time.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. /* Flag to indicate time is absolute. */
  60. # define TIMER_ABSTIME 1
  61. # endif
  62. # endif /* bits/time.h */
  63. #endif
  64. #ifdef __need_timeval
  65. # undef __need_timeval
  66. # ifndef _STRUCT_TIMEVAL
  67. # define _STRUCT_TIMEVAL 1
  68. # include <bits/types.h>
  69. /* A time value that is accurate to the nearest
  70. microsecond but also has a range of years. */
  71. struct timeval
  72. {
  73. __time_t tv_sec; /* Seconds. */
  74. __suseconds_t tv_usec; /* Microseconds. */
  75. };
  76. # endif /* struct timeval */
  77. #endif /* need timeval */