def form_relative_time(datasets):
    """
    Converts dataset timestamps in nano-seconds to seconds relative to first
    timestamp.
    """
    # Find first timestamp between all datasets
    first_ts = float('inf')
    for ds in datasets:
        if min(ds["ts"]) < first_ts:
            first_ts = min(ds["ts"])

    # Create a new relative time entry on all datasets
    retval = []
    for ds in datasets:
        ds["time"] = ds["ts"] - first_ts
        retval.append(ds)

    return retval