DATE = 3
FORMAT = 4
AS_LENGTH = 5
+ TIMESTAMP = 6
# add: date, date as string, weekday, ...
# (whatever you need!)
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:]
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 "???"
DEFAULT = 0
WITH_SECONDS = 1
NO_SECONDS = 2
+ IN_SECONDS = 3
def __init__(self, type):
Converter.__init__(self, type)
self.type = self.WITH_SECONDS
elif type == "NoSeconds":
self.type = self.NO_SECONDS
+ elif type == "InSeconds":
+ self.type = self.IN_SECONDS
else:
self.type = self.DEFAULT
return "+%d:%02d" % (remaining / 3600, (remaining / 60) - ((remaining / 3600) * 60))
else:
return "%02d:%02d" % (duration / 3600, (duration / 60) - ((duration / 3600) * 60))
+ elif self.type == self.IN_SECONDS:
+ if remaining is not None:
+ return str(remaining)
+ else:
+ return str(duration)
elif self.type == self.DEFAULT:
if remaining is not None:
return "+%d min" % (remaining / 60)