fixes calculation for time format