[Tutor] Accuracy of time.sleep()
Dave S
pythontut at pusspaws.net
Sat Dec 4 18:55:08 CET 2004
>
> I expected the script to re-start 2-3 seconds after 8:05, python
> reloading after a long sleep etc, what I get is the script restarting
> at 08:04.55, earlier ???
>
> OK this is not a world stopping problem, more of a curiosity.
>
> Any suggestions
>
> Dave
>
Thanks for your input guys, I have used cron (fcron for me) in the past
(Im a Gentoo Linux guy :-) ) I was just trying to keep it all pure
python. As I said its more of a curiosity.
It must be cummulative error over 10s of thousands of seconds. Its a
bodge (& cron or at are better) but I suppose I could calculate seconds
to 8:05 sleep(seconds*0.95), re calculate secs to 8:05 sleep(seconds)
which should reduce the error to almost zip.
Dave
More information about the Tutor
mailing list