Replace obsolete usleep(3) with nanosleep(2).

git-svn-id: svn://daper.net/moc/trunk@2706 910807d9-36e0-0310-a014-e9ea483e2ba4
Replace obsolete gettimeofday(2) with clock_gettime(2).

OSX doesn't have clock_gettime(2) so we have chosen to continue using
gettimeofday(2) if clock_gettime(2) doesn't exist rather than navigate
the OSX-specific clock_get_time() or mach_absolute_time() functions.

git-svn-id: svn://daper.net/moc/trunk@2707 910807d9-36e0-0310-a014-e9ea483e2ba4
Replace the timeval struct with the newer timespec throughout.

The timeval struct has microsecond precision while timespec has
nanosecond precision, of which machines are now routinely capable
and new functions are increasingly using.

git-svn-id: svn://daper.net/moc/trunk@2708 910807d9-36e0-0310-a014-e9ea483e2ba4