[Python-Dev] time.sleep(-1) behaviour

Ulrich Eckhardt ulrich.eckhardt at dominolaser.com
Thu Jun 30 21:13:46 CEST 2011


Hi!

This is a request for clarification for the thread "how to call a function for 
evry 10 seconds" from the user mailinglist/newsgroup.


The gist is this:
1. On Linux/Python 2.6, time.sleep(-1.0) raises an IOError.
2. On MS Windows/Python 2.5 or 2.7 this sleeps forever. It seems that 
converting this to a 32-bit integer for Sleep() causes an underflow.


Questions:
1. Is the IOError somehow explainable?
2. Is the IOError acceptable or a bug?
3. Is the behaviour under MS Windows acceptable or a bug?
4. Since time.sleep() is documented to possibly sleep a bit longer than 
specified, someone suggested that the overall sleep time could also be 
truncated to a minimum of zero, i.e. treating negative values as zero.


Greetings!

Uli
**************************************************************************************
Domino Laser GmbH, Fangdieckstraße 75a, 22547 Hamburg, Deutschland
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
**************************************************************************************
Visit our website at http://www.dominolaser.com
**************************************************************************************
Diese E-Mail einschließlich sämtlicher Anhänge ist nur für den Adressaten bestimmt und kann vertrauliche Informationen enthalten. Bitte benachrichtigen Sie den Absender umgehend, falls Sie nicht der beabsichtigte Empfänger sein sollten. Die E-Mail ist in diesem Fall zu löschen und darf weder gelesen, weitergeleitet, veröffentlicht oder anderweitig benutzt werden.
E-Mails können durch Dritte gelesen werden und Viren sowie nichtautorisierte Änderungen enthalten. Domino Laser GmbH ist für diese Folgen nicht verantwortlich.
**************************************************************************************



More information about the Python-Dev mailing list