[vlc-devel] [PATCH] timespec_get: fix sys/time.h include usage

Steve Lhomme robux4 at gmail.com
Tue Oct 24 17:46:53 CEST 2017


On Tue, Oct 24, 2017 at 5:29 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> Le tiistaina 24. lokakuuta 2017, 14.00.11 EEST Steve Lhomme a écrit :
>> If gettimeofday doesn't exist we shouldn't include it.
>> Matched the include used in vlc_fixups.h
>> ---
>>  compat/timespec_get.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/compat/timespec_get.c b/compat/timespec_get.c
>> index 350e912fd0..24bc894cad 100644
>> --- a/compat/timespec_get.c
>> +++ b/compat/timespec_get.c
>> @@ -28,7 +28,9 @@
>>  #define _POSIX_TIMERS (-1)
>>  #endif
>>  #if (_POSIX_TIMERS <= 0)
>> -# include <sys/time.h> /* gettimeofday() */
>> +# ifdef HAVE_GETTIMEOFDAY
>> +#  include <sys/time.h> /* gettimeofday() */
>> +# endif
>>  #endif
>
> This is totally counter-sensical.

We could do the same with an extra HAVE_SYS_TIME_H. But for now if we
have HAVE_GETTIMEOFDAY that means it was found in sys/time.h. If we
don't it's likely the header doesn't even exist (this is my case).

>>
>>  int timespec_get(struct timespec *ts, int base)
>
>
> --
> 雷米‧德尼-库尔蒙
> https://www.remlab.net/
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list