def timestamp_to_ms(time_str):
    """
    Convert timestamp string to milliseconds.

    Note that `time_str` is in format 'hour:minute:second.10-milliseconds'
    """
    hour, minute, sec_ten_ms = time_str.split(':')
    sec, ten_ms = sec_ten_ms.split('.')
    hour, minute, sec, ms = int(hour), int(minute), int(sec), int(ten_ms) * 10
    total_ms = hour * 3600 * 1000 + minute * 60 * 1000 + sec * 1000 + ms
    return total_ms