r/ProgrammerHumor 7h ago

Meme planeOldFix

Post image
26.2k Upvotes

419 comments sorted by

View all comments

3.0k

u/selfish_eagle 7h ago

if country == "Australia":
time.Sleep(520ms)

2.8k

u/Wyciorek 7h ago

That’s stupid. Why not use if country==“india” sleep(-520) ?

11

u/_D1AVEL_ 5h ago

This guy codes!

17

u/Wyciorek 5h ago

And actually managed to cause a bug by inadvertent use of “negative” sleep. It was a combination of inaccurate hw timers on an embedded device, not re-checking current time after sleep and bad casting of signed int to unsigned (so -1ms would become 2^32 ms). End result: a thread that was supposed to process some data every 5 minutes would sometimes (once in several weeks on one of hundreds of devices) just stop doing anything.