replace sleep interval calculation with more correct one

The old timing routine will fall further behind the intended schedule by a fraction of a second on every iteration because it does not account for the time between that passes between the calculation of start_time and cycle_time. This new calculation should solve that problem.