hw/ds1338.c: Correct bug in conversion to BCD.
authorAntoine Mathys <barsamin@gmail.com>
Thu, 13 Dec 2012 14:05:27 +0000 (14:05 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 13 Dec 2012 14:05:27 +0000 (14:05 +0000)
Signed-off-by: Antoine Mathys <barsamin@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/ds1338.c

index b576d564387f06366d51fe5a81ed2dbe44edd62e..faaa4a0a93c4d9349a3f8069a0fb559b2a5efd9a 100644 (file)
@@ -57,9 +57,9 @@ static void capture_current_time(DS1338State *s)
     } else {
         s->nvram[2] = to_bcd(now.tm_hour);
     }
-    s->nvram[3] = to_bcd(now.tm_wday) + 1;
+    s->nvram[3] = to_bcd(now.tm_wday + 1);
     s->nvram[4] = to_bcd(now.tm_mday);
-    s->nvram[5] = to_bcd(now.tm_mon) + 1;
+    s->nvram[5] = to_bcd(now.tm_mon + 1);
     s->nvram[6] = to_bcd(now.tm_year - 100);
 }