compute_event_durations function

Computation of event durations.