use duration instead of end time