aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/Converter/EventTime.py
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2006-07-30 22:56:43 +0000
committerFelix Domke <tmbinc@elitedvb.net>2006-07-30 22:56:43 +0000
commit1557c715e461d5a7deb04bb008c6497441351bbe (patch)
tree8a378b20ca3bebab0b2eca1742c10dfd746cb2a1 /lib/python/Components/Converter/EventTime.py
parentb8783e5b26a7dd0601bece623c4cbfe19f57977b (diff)
downloadenigma2-1557c715e461d5a7deb04bb008c6497441351bbe.tar.gz
enigma2-1557c715e461d5a7deb04bb008c6497441351bbe.zip
some minor speedups using caches and more selective updating
Diffstat (limited to 'lib/python/Components/Converter/EventTime.py')
-rw-r--r--lib/python/Components/Converter/EventTime.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/python/Components/Converter/EventTime.py b/lib/python/Components/Converter/EventTime.py
index 09fe6bff..4a73e0ac 100644
--- a/lib/python/Components/Converter/EventTime.py
+++ b/lib/python/Components/Converter/EventTime.py
@@ -30,6 +30,11 @@ class EventTime(Poll, Converter, object):
raise str("'%s' is not <StartTime|EndTime|Remaining|Duration> for EventTime converter" % type)
def getTime(self):
+ if self.cache is None or self.cache[0] is None:
+ self.cache = (self.__getTime(), self.cache and self.cache[1])
+ return self.cache[0]
+
+ def __getTime(self):
assert self.type != self.PROGRESS
event = self.source.event
@@ -53,6 +58,11 @@ class EventTime(Poll, Converter, object):
return (duration, None)
def getValue(self):
+ if self.cache is None or self.cache[1] is None:
+ self.cache = (self.cache and self.cache[0], self.__getValue())
+ return self.cache[1]
+
+ def __getValue(self):
assert self.type == self.PROGRESS
event = self.source.event