Skip to content
This repository
Newer
Older
100644 37 lines (32 sloc) 1.178 kb
04ee4803 » lkcl
2008-09-15 first svn add of trunk
1 import math
2
3 class TimeSlot:
4 def __init__(self, dayOfWeek, startMinutes, endMinutes):
5 self.DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
6 self.dayOfWeek = dayOfWeek
7 self.startMinutes = startMinutes
8 self.endMinutes = endMinutes
64eff557 » xtfxme
2012-05-14 find * -name '*.py' | xargs sed -i -r 's,\s+$,,'
9
04ee4803 » lkcl
2008-09-15 first svn add of trunk
10 def compareTo(self, other):
11 if self.dayOfWeek < other.dayOfWeek:
12 return -1
13 elif self.dayOfWeek > other.dayOfWeek:
14 return 1
15 else:
16 if self.startMinutes < other.startMinutes:
17 return -1
18 elif self.startMinutes > other.startMinutes:
19 return 1
20 return 0
21
22 def getDayOfWeek(self):
23 return self.dayOfWeek
24
25 def getDescription(self):
26 return self.DAYS[self.dayOfWeek] + " " + self.getHrsMins(self.startMinutes) + "-" + self.getHrsMins(self.endMinutes)
64eff557 » xtfxme
2012-05-14 find * -name '*.py' | xargs sed -i -r 's,\s+$,,'
27
04ee4803 » lkcl
2008-09-15 first svn add of trunk
28 def getHrsMins(self, mins):
29 hrs = math.floor(mins / 60)
30 if hrs > 12:
31 hrs -= 12
32 remainder = math.floor(mins % 60)
33 if remainder < 10:
34 string_mins = "0" + str(remainder)
35 else:
36 string_mins = str(remainder)
37 return str(hrs) + ":" + string_mins
38
Something went wrong with that request. Please try again.