def main(): time = Time() time.hour = 11 time.minute = 59 time.second = 30 print_time(time) time1 = time time2 = Time() time2.hour = 11 time2.minute = 59 time2.second = 40 print_time(time1) print_time(time2) after = is_after(time1, time2) print(after) start = Time() start.hour = 9 start.minute = 45 start.second = 0 duration = Time() duration.hour = 1 duration.minute = 35 duration.second = 0 done = add_time2(start, duration) print_time(done)
def add_time(t1, t2): sum = Time() sum.hour = t1.hour + t2.hour sum.minute = t1.minute + t2.minute sum.second = t1.second + t2.second return sum