gethrxtime.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* gethrxtime -- get high resolution real time
  2. Copyright (C) 2005, 2009-2020 Free Software Foundation, Inc.
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <https://www.gnu.org/licenses/>. */
  13. /* Written by Paul Eggert. */
  14. #ifndef GETHRXTIME_H_
  15. #define GETHRXTIME_H_ 1
  16. #include "xtime.h"
  17. #ifndef _GL_INLINE_HEADER_BEGIN
  18. #error "Please include config.h first."
  19. #endif
  20. _GL_INLINE_HEADER_BEGIN
  21. #ifndef GETHRXTIME_INLINE
  22. # define GETHRXTIME_INLINE _GL_INLINE
  23. #endif
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. /* Get the current time, as a count of the number of nanoseconds since
  28. an arbitrary epoch (e.g., the system boot time). Prefer a
  29. high-resolution clock that is not subject to resetting or
  30. drifting. */
  31. #if HAVE_ARITHMETIC_HRTIME_T && HAVE_DECL_GETHRTIME
  32. # include <time.h>
  33. GETHRXTIME_INLINE xtime_t gethrxtime (void) { return gethrtime (); }
  34. # else
  35. xtime_t gethrxtime (void);
  36. #endif
  37. _GL_INLINE_HEADER_END
  38. #ifdef __cplusplus
  39. }
  40. #endif
  41. #endif