This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Historical query - time.h, sys/time.h
- To: zackw at Stanford dot EDU
- Subject: Re: Historical query - time.h, sys/time.h
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Tue, 1 May 2001 10:55:32 -0400 (EDT)
- Cc: gcc at gcc dot gnu dot org
> Has there ever been a system which had neither time.h nor sys/time.h?
> zw
I'm pretty sure you've got at least one on *hosted* systems. I can't
say for sure on freestanding ones...
The autoconf docs for TIME_WITH_SYS_TIME suggest the following
snippet:
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
Note it'll always include one or both of time.h & sys/time.h.
I checked and e.g. fileutils and gnutar use this style, and those are
pretty well circulated packages. So in practice, i.e. on systems gcc
supports, you'll have at least one.
Gcc itself is more careful to wrap the last time.h include in an
ifdef, but this is being extra careful, not necessarily needed IMHO.
--Kaveh
--
Kaveh R. Ghazi Engagement Manager / Project Services
ghazi@caip.rutgers.edu Qwest Internet Solutions