Use nanosleep() instead of repeated calls to clock() and fread()

Signed-off-by: Jacky Boen <aqiank@gmail.com>