git.cweiske.de
/
enigma2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2c46114
)
add Date functionality to ClockToText converter
author
Felix Domke
<tmbinc@elitedvb.net>
Mon, 26 Jun 2006 15:50:30 +0000
(15:50 +0000)
committer
Felix Domke
<tmbinc@elitedvb.net>
Mon, 26 Jun 2006 15:50:30 +0000
(15:50 +0000)
lib/python/Components/Converter/ClockToText.py
patch
|
blob
|
history
diff --git
a/lib/python/Components/Converter/ClockToText.py
b/lib/python/Components/Converter/ClockToText.py
index 085ebc1a3a8dc9db95fa0c2063ad150281813838..61c176eb3519777c28e491e8c32951aea56c5cec 100644
(file)
--- a/
lib/python/Components/Converter/ClockToText.py
+++ b/
lib/python/Components/Converter/ClockToText.py
@@
-1,10
+1,11
@@
from Components.Converter.Converter import Converter
from Components.Converter.Converter import Converter
-from time import localtime
+from time import localtime
, strftime
class ClockToText(Converter, object):
DEFAULT = 0
WITH_SECONDS = 1
IN_MINUTES = 2
class ClockToText(Converter, object):
DEFAULT = 0
WITH_SECONDS = 1
IN_MINUTES = 2
+ DATE = 3
# add: date, date as string, weekday, ...
# (whatever you need!)
# add: date, date as string, weekday, ...
# (whatever you need!)
@@
-15,6
+16,8
@@
class ClockToText(Converter, object):
self.type = self.WITH_SECONDS
elif type == "InMinutes":
self.type = self.IN_MINUTES
self.type = self.WITH_SECONDS
elif type == "InMinutes":
self.type = self.IN_MINUTES
+ elif type == "Date":
+ self.type = self.DATE
else:
self.type = self.DEFAULT
else:
self.type = self.DEFAULT
@@
-33,6
+36,8
@@
class ClockToText(Converter, object):
return "%2d:%02d:%02d" % (t.tm_hour, t.tm_min, t.tm_sec)
elif self.type == self.DEFAULT:
return "%02d:%02d" % (t.tm_hour, t.tm_min)
return "%2d:%02d:%02d" % (t.tm_hour, t.tm_min, t.tm_sec)
elif self.type == self.DEFAULT:
return "%02d:%02d" % (t.tm_hour, t.tm_min)
+ elif self.type == self.DATE:
+ return strftime("%A %B %d, %Y", t)
else:
return "???"
else:
return "???"