Author: remi
Date: 2009-06-26 10:52:47 +0200 (Fri, 26 Jun 2009)
New Revision: 4905

Modified:
   software_suite_v3/smart-core/smart-server/trunk/util/scheduler/Task.py
Log:
* fixed bug (Task every x from full hour with delay of 1 hour, when the server 
is launched between 00H and 01H ...) I am lucky to saw this bug ...

Modified: software_suite_v3/smart-core/smart-server/trunk/util/scheduler/Task.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/util/scheduler/Task.py      
2009-06-26 08:49:28 UTC (rev 4904)
+++ software_suite_v3/smart-core/smart-server/trunk/util/scheduler/Task.py      
2009-06-26 08:52:47 UTC (rev 4905)
@@ -50,17 +50,20 @@
         self.__monthAtStart = now.month
         self.__monthMask = self.__createMonthMask(self.__monthAtStart)
         if ruleType == SCH_LOOP_ABS:
+            hourFixe = now.hour - delay[0]
+            if hourFixe < 0:
+                hourFixe = 0
             if delay[0] == 0:
                 if delay[1] == 0:
                     m = 0
                 else:
                     m = int(now.minute / delay[1]) * delay[1]
                 self.__startTime = datetime.datetime(now.year, now.month,
-                    now.day, now.hour - delay[0], m, delay[2])
+                    now.day, hourFixe, m, delay[2])
                 self.__incrementTime = datetime.timedelta(minutes = delay[1])
             else:
                 self.__startTime = datetime.datetime(now.year, now.month,
-                    now.day, now.hour - delay[0], delay[1], delay[2])
+                    now.day, hourFixe, delay[1], delay[2])
                 self.__incrementTime = datetime.timedelta(hours = delay[0])
         elif ruleType == SCH_LOOP_REL:
             self.__startTime = datetime.datetime.now()


------------------------------------------------------------------------------
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to