Fix duration calculation in the presence of a single wraping of the timeline.