sys_time.in.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* Provide a more complete sys/time.h.
  2. Copyright (C) 2007-2011 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 Lesser General Public License as published by
  5. the Free Software Foundation; either version 2, or (at your option)
  6. 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 Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public License
  12. along with this program; if not, write to the Free Software Foundation,
  13. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
  14. /* Written by Paul Eggert. */
  15. #if __GNUC__ >= 3
  16. @PRAGMA_SYSTEM_HEADER@
  17. #endif
  18. @PRAGMA_COLUMNS@
  19. #if defined _GL_SYS_TIME_H
  20. /* Simply delegate to the system's header, without adding anything. */
  21. # if @HAVE_SYS_TIME_H@
  22. # @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
  23. # endif
  24. #else
  25. # define _GL_SYS_TIME_H
  26. # if @HAVE_SYS_TIME_H@
  27. # @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
  28. # else
  29. # include <time.h>
  30. # endif
  31. /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
  32. /* The definition of _GL_ARG_NONNULL is copied here. */
  33. /* The definition of _GL_WARN_ON_USE is copied here. */
  34. # ifdef __cplusplus
  35. extern "C" {
  36. # endif
  37. # if ! @HAVE_STRUCT_TIMEVAL@
  38. # if !GNULIB_defined_struct_timeval
  39. struct timeval
  40. {
  41. time_t tv_sec;
  42. long int tv_usec;
  43. };
  44. # define GNULIB_defined_struct_timeval 1
  45. # endif
  46. # endif
  47. # ifdef __cplusplus
  48. }
  49. # endif
  50. # if @GNULIB_GETTIMEOFDAY@
  51. # if @REPLACE_GETTIMEOFDAY@
  52. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  53. # undef gettimeofday
  54. # define gettimeofday rpl_gettimeofday
  55. # endif
  56. _GL_FUNCDECL_RPL (gettimeofday, int,
  57. (struct timeval *restrict, void *restrict)
  58. _GL_ARG_NONNULL ((1)));
  59. _GL_CXXALIAS_RPL (gettimeofday, int,
  60. (struct timeval *restrict, void *restrict));
  61. # else
  62. # if !@HAVE_GETTIMEOFDAY@
  63. _GL_FUNCDECL_SYS (gettimeofday, int,
  64. (struct timeval *restrict, void *restrict)
  65. _GL_ARG_NONNULL ((1)));
  66. # endif
  67. /* Need to cast, because on glibc systems, by default, the second argument is
  68. struct timezone *. */
  69. _GL_CXXALIAS_SYS_CAST (gettimeofday, int,
  70. (struct timeval *restrict, void *restrict));
  71. # endif
  72. _GL_CXXALIASWARN (gettimeofday);
  73. # elif defined GNULIB_POSIXCHECK
  74. # undef gettimeofday
  75. # if HAVE_RAW_DECL_GETTIMEOFDAY
  76. _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
  77. "use gnulib module gettimeofday for portability");
  78. # endif
  79. # endif
  80. #endif /* _GL_SYS_TIME_H */