True if times can be compared.

def _valid_comparison(time_a, time_b, event_a, event_b):
    """True if times can be compared."""
    if time_a == time_b:
        # Ties are only informative if exactly one event happened
        return event_a != event_b
    if event_a and event_b:
        return True
    if event_a and time_a < time_b:
        return True
    if event_b and time_b < time_a:
        return True
    return False