patch by moritz venn: wrap around for minutes/hours
authorFelix Domke <tmbinc@elitedvb.net>
Mon, 26 Jan 2009 22:47:10 +0000 (23:47 +0100)
committerFelix Domke <tmbinc@elitedvb.net>
Mon, 26 Jan 2009 22:47:10 +0000 (23:47 +0100)
lib/python/Components/config.py

index a7724f4..6eeca69 100755 (executable)
@@ -629,11 +629,12 @@ class ConfigClock(ConfigSequence):
        def increment(self):
                # Check if Minutes maxed out
                if self._value[1] == 59:
-                       # Check if Hours not maxed out
+                       # Increment Hour, reset Minutes
                        if self._value[0] < 23:
-                               # Increment Hour, reset Minutes to 0
                                self._value[0] += 1
-                               self._value[1] = 0
+                       else:
+                               self._value[0] = 0
+                       self._value[1] = 0
                else:
                        # Increment Minutes
                        self._value[1] += 1
@@ -643,11 +644,12 @@ class ConfigClock(ConfigSequence):
        def decrement(self):
                # Check if Minutes is minimum
                if self._value[1] == 0:
-                       # Check if Hour is greater than 0
+                       # Decrement Hour, set Minutes to 59
                        if self._value[0] > 0:
-                               # Decrement Hour, set Minutes to 59
                                self._value[0] -= 1
-                               self._value[1] = 59
+                       else:
+                               self._value[0] = 23
+                       self._value[1] = 59
                else:
                        # Decrement Minutes
                        self._value[1] -= 1