Replaced a sleep() by a nanosleep(), fixing implicit float->int conversion