Commit 04064430 authored by Paul Eggert's avatar Paul Eggert

Merge from gnulib

This incorporates:
2017-03-04 dtotimespec: simplify
* lib/dtotimespec.c: Copy from gnulib.
parent 53f3dd66
......@@ -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
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment