Under what kind of situation, time.sleep(n) would sleep much longer than n seconds?

Marko Rauhamaa marko at pacujo.net
Wed Jun 18 06:30:26 EDT 2014


crow <wentlv at gmail.com>:

> I'm writing some scripts with python, and I found sometimes, when I
> try to use time.sleep(1) to sleep 1 sec, it would actually sleep for 9
> secs or even longer.
>
> [...]
>
> So, my question: under what kind of condition, time.sleep would
> suspend longer time than expected?

That could happen if your computer were extremely busy. Otherwise, I'd
say you are mistaken in your analysis, or you are running a broken
virtual machine.


Marko



More information about the Python-list mailing list