Skip to content

Commit

Permalink
create Time object as datetime.datetime object
Browse files Browse the repository at this point in the history
  • Loading branch information
epequeno committed Feb 5, 2013
1 parent 2c0a577 commit 9def08f
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions ch16/16.02.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,10 @@

# Current Satus: Incomplete

import datetime

class Time(object):
""" represents the time of day.
attributes: hour, minute, second"""

t1 = Time()
t1.hour = 11
t1.minute = 59
t1.second = 30

t2 = Time()
t2.hour = 10
t2.minute = 45
t2.second = 25


def is_after(t1, t2):
t1_total_seconds = (t1.hour * 3600) + (t1.minute * 60) + t1.second
t2_total_seconds = (t2.hour * 3600) + (t2.minute * 60) + t2.second
return t1_total_seconds > t2_total_seconds

print is_after(t1, t2)
def __init__(self, year=2000, month=1, day=1, hour=12, minute=0, sec=0):
self.date = datetime.datetime(year, month, day, hour, minute, sec)


0 comments on commit 9def08f

Please sign in to comment.