b0172d2346
integer (previously it was just clamped at the max possible value). This would have caused sleep 10000000000000000000 (or anything bigger) to have only actually slept for 9223372036854775807 secs. Someone would have noticed that happen, one day, in some other universe. This is now an error, as it was previously if this had been entered as sleep 1e19 Also detect an attempt to sleep for so long that a time_t will no longer be able to represent the current time when the sleep is done. Undo the attempts to work around a broken kernel nanosleep() implementation (by only ever issuing shortish sleep requests, and looping). That code was broken (idiot botch of mine) though you would have had to wait a month to observe it happen. I was going to just fix it, but sanity prevailed, and the kernel got fixed instead. That allows this to be much simplified, only looping as needed to handle dealing with SIGINFO. Switch to using clock_nanosleep() to implement the delay, as while our nanosleep() uses CLOCK_MONOTONIC the standards say it should use CLOCK_REALTIME, and if that we ever changed that, the old way would alter "sleep 5" from "sleep for 5 seconds" to "sleep until now + 5 secs", which is subtly different. Always use %g format to print the original sleep duration in reports of how much time remains - this works best for both long and short durations. A couple of other minor (frill) mods to the SIGINFO report message as well. |
||
---|---|---|
.. | ||
Makefile | ||
sleep.1 | ||
sleep.c |