Hi :) On Tue 13 Jan 2015 13:58, l...@gnu.org (Ludovic Courtès) writes:
> I just noticed that ‘sleep’ essentially always rounds down its return > value, which makes it unreliable, as in this example: > > $ time guile -c '(sigaction SIGINT +) (call-with-new-thread (lambda () (let > loop () (kill (getpid) SIGINT) (loop)))) (let loop ((n 3)) (when (> n 0) > (loop (sleep (pk "s" n)))))' > > ;;; ("s" 3) > > ;;; ("s" 2) > > ;;; ("s" 1) > > real 0m0.039s > user 0m0.052s > sys 0m0.017s > > Here ‘loop’ is meant to assure we sleep for roughly 3 seconds, but > because of the incorrect rounding, we end up not sleeping at all. Hummmmmmmmmm. I don't think we can change anything in 2.0. Right? In master, how about (1) we allow sleep to take any real number, in seconds; (2) sleep returns an inexact real number. Then we can deprecate usleep and "standardize" on sleeping in units of seconds. Internally we refactor scm_std_usleep/* to take a 64-bit double for the number of seconds to sleep and return a double for the time remaining. WDYT? Andy