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