Clock Arithmetic Still Hard
Clock or modular arithmetic is hard. Take a look at the two code snippets below. Both seem reasonable integer comparison functions modeled after strcmp(). However, the left one contains an overflow bug. I have thirty odd years of programming experience, yet I had to be pointed out the bug. The left snippet looks obviously wrong …