def _compute_delta_t(
        data: dict, nodeid: str, event1: str, event1_pos: int, event2: str,
        event2_pos: int) -> float:
    """Compute time delta between two events
    :param dict data: data
    :param str nodeid: node id
    :param str event1: event1
    :param int event1_pos: event1 position in stream
    :param str event2: event2
    :param int event2_pos: event2 position in stream
    :rtype: float
    :return: delta t of events
    """
    # attempt to get directly recorded diff
    try:
        return data[nodeid][event2][event2_pos]['message']['diff']
    except (TypeError, KeyError):
        return (data[nodeid][event2][event2_pos]['timestamp'] -
                data[nodeid][event1][event1_pos]['timestamp']).total_seconds()