/sys/src/cmd/gs/src/time_.h

https://github.com/josephzizys/plan-9 · C Header · 95 lines · 37 code · 11 blank · 47 comment · 9 complexity · 0f989733433de599174904816b3b9abd MD5 · raw file

  1. /* Copyright (C) 1991, 1995, 1997, 1998 Aladdin Enterprises. All rights reserved.
  2. This software is provided AS-IS with no warranty, either express or
  3. implied.
  4. This software is distributed under license and may not be copied,
  5. modified or distributed except as expressly authorized under the terms
  6. of the license contained in the file LICENSE in this distribution.
  7. For more information about licensing, please refer to
  8. http://www.ghostscript.com/licensing/. For information on
  9. commercial licensing, go to http://www.artifex.com/licensing/ or
  10. contact Artifex Software, Inc., 101 Lucas Valley Road #110,
  11. San Rafael, CA 94903, U.S.A., +1(415)492-9861.
  12. */
  13. /* $Id: time_.h,v 1.8 2003/08/16 23:59:19 giles Exp $ */
  14. /* Generic substitute for Unix sys/time.h */
  15. #ifndef time__INCLUDED
  16. # define time__INCLUDED
  17. /* We must include std.h before any file that includes sys/types.h. */
  18. #include "std.h"
  19. /*
  20. * The location (or existence) of certain system headers is
  21. * environment-dependent. We detect this in the makefile
  22. * and conditionally define switches in gconfig_.h.
  23. */
  24. #include "gconfig_.h"
  25. /*
  26. * Some System V environments don't include sys/time.h.
  27. * The HAVE_SYS_TIME_H switch in gconfig_.h reflects this.
  28. */
  29. #ifdef HAVE_SYS_TIME_H
  30. # include <sys/time.h>
  31. # if defined(Plan9) || defined(M_UNIX) || defined(_IBMR2) || defined(_SEQUENT_) || defined(__GNUC__) || defined(__INTEL_COMPILER)
  32. /* Plan 9, SCO, AIX and Sequent's DYNIX/ptx need both time.h and
  33. * sys/time.h! As of version 2.2, at least some glibc
  34. * installations also require both files.
  35. * Following Duraid Madina's request we also do it on Intel compiler.
  36. */
  37. # include <time.h>
  38. # endif
  39. #else
  40. # include <time.h>
  41. # if !defined(__DECC) && !defined(__MWERKS__)
  42. struct timeval {
  43. long tv_sec, tv_usec;
  44. };
  45. # endif
  46. struct timezone {
  47. int tz_minuteswest, tz_dsttime;
  48. };
  49. #endif
  50. #if defined(ultrix) && defined(mips)
  51. /*
  52. * Apparently some versions of Ultrix for the DECstation include
  53. * time_t in sys/time.h, and some don't. If you get errors
  54. * compiling gp_unix.c, uncomment the next line.
  55. */
  56. /* typedef int time_t; */
  57. #endif
  58. /*
  59. * In SVR4.0 (but not other System V implementations),
  60. * gettimeofday doesn't take a timezone argument.
  61. */
  62. #ifdef SVR4_0
  63. # define gettimeofday_no_timezone 1
  64. #else
  65. # define gettimeofday_no_timezone 0
  66. #endif
  67. /* Some System V environments, and Posix environments, need <sys/times.h>. */
  68. #ifdef HAVE_SYS_TIMES_H
  69. # include <sys/times.h>
  70. # define use_times_for_usertime 1
  71. /* Posix 1003.1b-1993 section 4.8.1.5 says that
  72. CLK_TCK is obsolescent and that sysconf(_SC_CLK_TCK)
  73. should be used instead, but this requires including
  74. <unistd.h>, which is too painful to configure. */
  75. # ifndef CLK_TCK
  76. # define CLK_TCK 100 /* guess for older hosts */
  77. # endif
  78. #else
  79. # define use_times_for_usertime 0
  80. #endif
  81. #endif /* time__INCLUDED */