Merge from gnulib
This incorporates: 2017-03-04 dtotimespec: simplify * lib/dtotimespec.c: Copy from gnulib.
This commit is contained in:
parent
53f3dd66f1
commit
0406443021
1 changed files with 2 additions and 8 deletions
|
@ -29,15 +29,9 @@
|
|||
struct timespec
|
||||
dtotimespec (double sec)
|
||||
{
|
||||
double min_representable = TYPE_MINIMUM (time_t);
|
||||
double max_representable =
|
||||
((TYPE_MAXIMUM (time_t) * (double) TIMESPEC_RESOLUTION
|
||||
+ (TIMESPEC_RESOLUTION - 1))
|
||||
/ TIMESPEC_RESOLUTION);
|
||||
|
||||
if (! (min_representable < sec))
|
||||
if (! (TYPE_MINIMUM (time_t) < sec))
|
||||
return make_timespec (TYPE_MINIMUM (time_t), 0);
|
||||
else if (! (sec < max_representable))
|
||||
else if (! (sec < 1.0 + TYPE_MAXIMUM (time_t)))
|
||||
return make_timespec (TYPE_MAXIMUM (time_t), TIMESPEC_RESOLUTION - 1);
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue