1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-10-30 10:45:40 +03:00

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.

Reviewed-by: Sam James <sam@gentoo.org>
This commit is contained in:
Adhemerval Zanella
2025-10-17 16:13:02 -03:00
parent ca3e2f12af
commit 77bab6dd99

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
{