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