diff options
| author | Paul Eggert | 2017-03-05 13:30:32 -0800 |
|---|---|---|
| committer | Paul Eggert | 2017-03-05 13:31:33 -0800 |
| commit | 040644302120bfb11f28461aadb96c14e39f8630 (patch) | |
| tree | 044cb24a0fbd98f7044c6e7fba2a7337eb34bd7e | |
| parent | 53f3dd66f12660a47018fc03d50d460787ab6f64 (diff) | |
| download | emacs-040644302120bfb11f28461aadb96c14e39f8630.tar.gz emacs-040644302120bfb11f28461aadb96c14e39f8630.zip | |
Merge from gnulib
This incorporates:
2017-03-04 dtotimespec: simplify
* lib/dtotimespec.c: Copy from gnulib.
| -rw-r--r-- | lib/dtotimespec.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/dtotimespec.c b/lib/dtotimespec.c index 9d81b68d817..3ca5a9cfd35 100644 --- a/lib/dtotimespec.c +++ b/lib/dtotimespec.c | |||
| @@ -29,15 +29,9 @@ | |||
| 29 | struct timespec | 29 | struct timespec |
| 30 | dtotimespec (double sec) | 30 | dtotimespec (double sec) |
| 31 | { | 31 | { |
| 32 | double min_representable = TYPE_MINIMUM (time_t); | 32 | if (! (TYPE_MINIMUM (time_t) < sec)) |
| 33 | double max_representable = | ||
| 34 | ((TYPE_MAXIMUM (time_t) * (double) TIMESPEC_RESOLUTION | ||
| 35 | + (TIMESPEC_RESOLUTION - 1)) | ||
| 36 | / TIMESPEC_RESOLUTION); | ||
| 37 | |||
| 38 | if (! (min_representable < sec)) | ||
| 39 | return make_timespec (TYPE_MINIMUM (time_t), 0); | 33 | return make_timespec (TYPE_MINIMUM (time_t), 0); |
| 40 | else if (! (sec < max_representable)) | 34 | else if (! (sec < 1.0 + TYPE_MAXIMUM (time_t))) |
| 41 | return make_timespec (TYPE_MAXIMUM (time_t), TIMESPEC_RESOLUTION - 1); | 35 | return make_timespec (TYPE_MAXIMUM (time_t), TIMESPEC_RESOLUTION - 1); |
| 42 | else | 36 | else |
| 43 | { | 37 | { |