from datetime import datetime


def detect_resolution(d1: datetime, d2: datetime) -> int:
    """ Detects the time difference in milliseconds between two datetimes in ms

    :param d1:
    :param d2:
    :return: time difference in milliseconds
    """
    delta = d1 - d2
    return int(delta.total_seconds() * 1e3)