aboutsummaryrefslogtreecommitdiff
path: root/timer.py
diff options
context:
space:
mode:
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>2007-06-18 22:19:54 +0000
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>2007-06-18 22:19:54 +0000
commit69d19bb77913e6b543a9bdae403c31550114cfdf (patch)
tree734f831ed1830cfadd086c9b2b770606e57a884f /timer.py
parent0d097e34703fd213f60e64d8ec11b046540bff5c (diff)
downloadenigma2-69d19bb77913e6b543a9bdae403c31550114cfdf.tar.gz
enigma2-69d19bb77913e6b543a9bdae403c31550114cfdf.zip
added a "Starting on" option to set a starting date for repeated timers
Diffstat (limited to 'timer.py')
-rw-r--r--timer.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/timer.py b/timer.py
index 3c66c925..0ad53af9 100644
--- a/timer.py
+++ b/timer.py
@@ -17,6 +17,9 @@ class TimerEntry:
self.end = end
self.state = 0
self.resetRepeated()
+ #begindate = localtime(self.begin)
+ #newdate = datetime.datetime(begindate.tm_year, begindate.tm_mon, begindate.tm_mday 0, 0, 0);
+ self.repeatedbegindate = begin
self.backoff = 0
self.disabled = False
@@ -45,6 +48,7 @@ class TimerEntry:
now = int(time()) + 1
#to avoid problems with daylight saving, we need to calculate with localtime, in struct_time representation
+ localrepeatedbegindate = localtime(self.repeatedbegindate)
localbegin = localtime(self.begin)
localend = localtime(self.end)
localnow = localtime(now)
@@ -64,7 +68,9 @@ class TimerEntry:
print strftime("%c", localnow)
- while ((day[localbegin.tm_wday] != 0) or ((day[localbegin.tm_wday] == 0) and ((findRunningEvent and localend < localnow) or ((not findRunningEvent) and localbegin < localnow)))):
+ # if day is NOT in the list of repeated days
+ # OR if the day IS in the list of the repeated days, check, if event is currently running... then if findRunningEvent is false, go to the next event
+ while ((day[localbegin.tm_wday] != 0) or (mktime(localrepeatedbegindate) > mktime(localbegin)) or ((day[localbegin.tm_wday] == 0) and ((findRunningEvent and localend < localnow) or ((not findRunningEvent) and localbegin < localnow)))):
localbegin = self.addOneDay(localbegin)
localend = self.addOneDay(localend)
print "localbegin after addOneDay:", strftime("%c", localbegin)