]> git.eshelyaron.com Git - emacs.git/commitdiff
Merge from gnulib
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 5 Mar 2017 21:30:32 +0000 (13:30 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 5 Mar 2017 21:31:33 +0000 (13:31 -0800)
This incorporates:
2017-03-04 dtotimespec: simplify
* lib/dtotimespec.c: Copy from gnulib.

lib/dtotimespec.c

index 9d81b68d817834489bc21d0b2570eb181bb353b8..3ca5a9cfd359a239d8b129976c571376caa0600b 100644 (file)
 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
     {