IN_MINUTES = 2
DATE = 3
FORMAT = 4
+ AS_LENGTH = 5
+ TIMESTAMP = 6
# add: date, date as string, weekday, ...
# (whatever you need!)
self.type = self.IN_MINUTES
elif type == "Date":
self.type = self.DATE
+ elif type == "AsLength":
+ self.type = self.AS_LENGTH
+ elif type == "Timestamp":
+ self.type = self.TIMESTAMP
elif str(type).find("Format") != -1:
self.type = self.FORMAT
self.fmt_string = type[7:]
# handle durations
if self.type == self.IN_MINUTES:
return "%d min" % (time / 60)
+ elif self.type == self.AS_LENGTH:
+ return "%d:%02d" % (time / 60, time % 60)
+ elif self.type == self.TIMESTAMP:
+ return str(time)
t = localtime(time)
return str(s1+s2)
else:
return strftime(self.fmt_string, t)
+
else:
return "???"