revert local change
[enigma2.git] / lib / python / Components / Sources / Clock.py
index 608a719..4833ddd 100644 (file)
@@ -1,4 +1,5 @@
 from Tools.Event import Event
+from Components.Element import cached
 from enigma import eTimer
 import time
 
@@ -8,10 +9,21 @@ class Clock(Source):
        def __init__(self):
                Source.__init__(self)
                self.clock_timer = eTimer()
-               self.clock_timer.timeout.get().append(self.changed)
+               self.clock_timer.timeout.get().append(self.poll)
                self.clock_timer.start(1000)
 
+       @cached
        def getClock(self):
                return time.time()
 
        time = property(getClock)
+
+       def poll(self):
+               self.changed((self.CHANGED_POLL,))
+
+       def doSuspend(self, suspended):
+               if suspended:
+                       self.clock_timer.stop()
+               else:
+                       self.clock_timer.start(1000)
+                       self.poll()