Fixed error with time calculation

Error caused time to not be displayed correctly at some points.