def time_transformation(obj_dt_time, time_interval):
    # transform the datetime.time object to time period
    """
    :param obj_dt_time: datetime.time object
    :param time_interval: in minute, e.g. 15 minutes
    :return: time period in minutes index from the mid-night, e.g. 5:15 is 5*60 + 15 = 315
    """
    total_seconds = obj_dt_time.hour * 3600 + obj_dt_time.minute * 60 + obj_dt_time.second
    trunc_seconds = total_seconds // (time_interval * 60) * (time_interval * 60)
    time_period = trunc_seconds // 60

    return time_period