[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sys/time.h and time.h
From: |
Zack Weinberg |
Subject: |
Re: sys/time.h and time.h |
Date: |
Sun, 28 Feb 2021 18:37:07 -0500 |
On Sun, Feb 28, 2021 at 5:44 PM Thien-Thi Nguyen <ttn@gnuvola.org> wrote:
> 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).)
Yes, (b) is what you should have, and a regular AC_CHECK_HEADERS for
sys/time.h. I'll happily take a patch to make this clearer in the
notes left by autoupdate and/or the manual.
zw