def compute_gap(time0, time1):
    """
    Compute the time difference between the given datetime objects in
    seconds (rounded to the nearest second.
    """
    tdelta = abs(time1 - time0)
    return round(tdelta.total_seconds())