Fix problem with sleep time calculation introduced in my last commit.
Reported by Thomas Kuntz.