Did I find the right examples for you? yes no

All Samples(2)  |  Call(2)  |  Derive(0)  |  Import(0)
Given a datetime and the duration (in minutes) of time levels,
return the datetime of the next level

        def next_level(cur_time, min_per_level):
    """
    Given a datetime and the duration (in minutes) of time levels,
    return the datetime of the next level
    """
    delta_per_level = datetime.timedelta(minutes=min_per_level)
    delta_min = cur_time.minute % min_per_level
    delta_sec = cur_time.second
    cur_delta = datetime.timedelta(minutes=delta_min, seconds=delta_sec)
    next_level = cur_time - cur_delta + delta_per_level
    return next_level
        


src/g/o/GooCalendar-0.1/goocalendar/_calendar.py   GooCalendar(Download)
            old_start = event_item.event.start
            new_start = old_start + diff_time
            next_level = util.next_level(old_start, self.MIN_PER_LEVEL)
            prev_level = util.prev_level(old_start, self.MIN_PER_LEVEL)
            if diff_time >= datetime.timedelta(0) and new_start >= next_level:
                new_start = util.prev_level(new_start, self.MIN_PER_LEVEL)
            elif diff_time < datetime.timedelta(0) and new_start <= prev_level:
                new_start = util.next_level(new_start, self.MIN_PER_LEVEL)