Beispiel #1
0
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)
Beispiel #2
0
def main():
    t_test = Time()
    t_test.hour, t_test.minute, t_test.second = 10, 30, 47

    t_pace = Time()
    t_pace.hour, t_pace.minute, t_pace.second = 0, 5, 30

    print_time(pace(t_pace, 0.3))
Beispiel #3
0
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
Beispiel #4
0
def int_to_time(seconds):
    time = Time()
    minutes, time.second = divmod(seconds, 60)
    time.hour, time.minute = divmod(minutes, 60)
    return time
Beispiel #5
0
from Time import Time

time = Time()

print("The attributes of time are: ")
print("time.hour: ", time.hour)
print("time.minute: ", time.minute)
print("time.second: ", time.second)

print("\nCalling method printMilitary: ")
time.printMilitary()

print("\nCalling method printStandard: ")
time.printStandard()

print("\nChanging time's hour attribute in a lazy manner")
time.hour = 25
print("\nCalling method printMilitary after alteration: ")
time.printMilitary()