Added a another case if that the waittime is zero, add (arrivaltime % 1.0f +1.0f) to the waiting time.