def add_hour(base_hour, dow):
    """Adds an hour to base_hour and ensures it's in range.
    Sets the day ahead if necessary.
    
    Operates on zero-based 24 hour clock hours.
    i.e. the 24th hour (midnight) is zero.
    """
    next_dow = dow
    next_hour = base_hour + 1
    
    if next_hour > 23:
        next_hour = 0
        next_dow = dow + 1
        if next_dow > 7:
            next_dow = 1
    return next_hour, next_dow