def timespan(ts):
    """Calculates the time span of the timeseries.

    Args:
        ts: A timeseries list of [time, value].

    Returns:
        The time span of the timeseries.
    """
    return ts[-1][0] - ts[0][0]