Historical query - time.h, sys/time.h

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Tue May 1 07:55:00 GMT 2001


 > 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



More information about the Gcc mailing list