ckolivas/cgminer — pull request #263 by luke-jr (2012-07-11 20:14:17+00:00)
Title: Bugfix: Calculate nsec in nmsleep correctly

The old algorithm (msecs * 1000000) - (sec / 1000000000) gets total nsec, including seconds, since the sec/1e9 should be multiplying. It's also vulnerable to easy overflows. Using ldiv gets the quotient and remainder in a single operation (at least on x86) and avoids overflow.