Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 39 lines (32 sloc) 1.178 kB
04ee480 first svn add of trunk
lkcl authored
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
64eff55 @xtfxme find * -name '*.py' | xargs sed -i -r 's,\s+$,,'
xtfxme authored
9
04ee480 first svn add of trunk
lkcl authored
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)
64eff55 @xtfxme find * -name '*.py' | xargs sed -i -r 's,\s+$,,'
xtfxme authored
27
04ee480 first svn add of trunk
lkcl authored
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.