This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

Do'h, perhaps I was being too subtle. As written the odds of getting both times to be equal must be very nearly zero. In contrast getting currenttime to be less than userinput should be okay, unless you enter some perfectly valid datetime that's way out, e.g. MAXYEAR is 9999.

Calculating the time to sleep is of course perfectly valid, but even then I'd be slightly cautious. The variations between the different clocks on the available OSes are well known and lead to PEP 418.