Patchwork [v3,1/6] hw/ds1338.c: Correct bug in conversion to BCD.

login
register
mail settings
Submitter Antoine Mathys
Date Dec. 12, 2012, 10:29 p.m.
Message ID <50C90537.10407@gmail.com>
Download mbox | patch
Permalink /patch/205670/
State New
Headers show

Comments

Antoine Mathys - Dec. 12, 2012, 10:29 p.m.
Signed-off-by: Antoine Mathys <barsamin@gmail.com>
---
  hw/ds1338.c |    4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/hw/ds1338.c b/hw/ds1338.c
index b576d56..faaa4a0 100644
--- a/hw/ds1338.c
+++ b/hw/ds1338.c
@@ -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);
  }