[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sys/time.h and time.h
From: |
Thien-Thi Nguyen |
Subject: |
sys/time.h and time.h |
Date: |
Sun, 28 Feb 2021 17:43:29 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
After running autoupdate (GNU Autoconf 2.71), i see in
configure.ac:
m4_warn([obsolete],
[Update your code to rely only on HAVE_SYS_TIME_H,
then remove this warning and the obsolete code below it.
All current systems provide time.h; it need not be checked for.
Not all systems provide sys/time.h, but those that do, all allow
you to include it and time.h simultaneously.])dnl
AC_CHECK_HEADERS_ONCE([sys/time.h])
# Obsolete code to be removed.
if test $ac_cv_header_sys_time_h = yes; then
AC_DEFINE([TIME_WITH_SYS_TIME],[1],[Define to 1 if you can safely include
both <sys/time.h>
and <time.h>. This macro is obsolete.])
fi
# End of obsolete code.
Currently, the source code has these stylized blocks:
#ifdef 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
My question is: To upgrade, which is preferred, (a) or (b)?
(a)
#if HAVE_SYS_TIME_H
# include <sys/time.h>
#else
# include <time.h>
#endif
(b)
#if HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#include <time.h>
The difference is #include <time.h> is unconditional in (b),
which is OK according to my reading of the warning message
above. (Thus, my guess is (b).)
--
Thien-Thi Nguyen -----------------------------------------------
(defun responsep (query) ; (2021) Software Libero
(pcase (context query) ; = Dissenso Etico
(`(technical ,ml) (correctp ml))
...)) 748E A0E8 1CB8 A748 9BFA
--------------------------------------- 6CE4 6703 2224 4C80 7502
signature.asc
Description: PGP signature
- sys/time.h and time.h,
Thien-Thi Nguyen <=