def time_delta_to_millis(delta):
    """Converts time delta into total number of milliseconds."""
    millis = delta.days * 24 * 60 * 60 * 1000
    millis += delta.seconds * 1000
    millis += delta.microseconds / 1000
    return millis