support: Handle clang support/dtotimespec.c on dtotimespec

clang issues:

dtotimespec.c:31:25: error: implicit conversion from 'time_t' (aka
'long') to 'double' changes value from 9223372036854775807 to
9223372036854775808 [-Werror,-Wimplicit-const-int-float-conversion]
  else if (sec >= 1.0 + TYPE_MAXIMUM (time_t))
                      ~ ^~~~~~~~~~~~~~~~~~~~~
../include/intprops.h:57:4: note: expanded from macro 'TYPE_MAXIMUM'
  ((t) (! TYPE_SIGNED (t)
\
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

So explicit cast it to double.
This commit is contained in:
Adhemerval Zanella 2023-03-20 16:20:48 -03:00
parent 1ae9eb770c
commit e143c8e6c7
1 changed files with 1 additions and 1 deletions

View File

@ -28,7 +28,7 @@ dtotimespec (double sec)
{
if (sec <= TYPE_MINIMUM (time_t))
return make_timespec (TYPE_MINIMUM (time_t), 0);
else if (sec >= 1.0 + TYPE_MAXIMUM (time_t))
else if (sec >= 1.0 + (double) TYPE_MAXIMUM (time_t))
return make_timespec (TYPE_MAXIMUM (time_t), TIMESPEC_HZ - 1);
else
{