From ladis@linux-mips.org Wed May  4 00:32:39 2005
Date: Wed, 4 May 2005 08:13:13 +0200
To: Greg KH <greg@kroah.com>
Cc: Jean Delvare <khali@linux-fr.org>, LKML <linux-kernel@vger.kernel.org>,
	LM Sensors <sensors@Stimpy.netroedge.com>,
	James Chapman <jchapman@katalix.com>
Subject: I2C: ds1337: Make time format consistent with other RTC drivers
Message-ID: <20050504061313.GB1439@orphique>
From: Ladislav Michl <ladis@linux-mips.org>


Make time format consistent with other RTC drivers.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: James Chapman <jchapman@katalix.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/i2c/chips/ds1337.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

--- gregkh-2.6.orig/drivers/i2c/chips/ds1337.c	2005-05-06 09:23:46.000000000 -0700
+++ gregkh-2.6/drivers/i2c/chips/ds1337.c	2005-05-06 09:23:48.000000000 -0700
@@ -130,8 +130,8 @@
 		dt->tm_wday = BCD2BIN(buf[3]) - 1;
 		dt->tm_mday = BCD2BIN(buf[4]);
 		val = buf[5] & 0x7f;
-		dt->tm_mon = BCD2BIN(val);
-		dt->tm_year = 1900 + BCD2BIN(buf[6]);
+		dt->tm_mon = BCD2BIN(val) - 1;
+		dt->tm_year = BCD2BIN(buf[6]);
 		if (buf[5] & 0x80)
 			dt->tm_year += 100;
 
@@ -171,12 +171,11 @@
 	buf[3] = BIN2BCD(dt->tm_hour) | (1 << 6);
 	buf[4] = BIN2BCD(dt->tm_wday) + 1;
 	buf[5] = BIN2BCD(dt->tm_mday);
-	buf[6] = BIN2BCD(dt->tm_mon);
-	if (dt->tm_year >= 2000) {
-		val = dt->tm_year - 2000;
+	buf[6] = BIN2BCD(dt->tm_mon) + 1;
+	val = dt->tm_year;
+	if (val >= 100) {
+		val -= 100;
 		buf[6] |= (1 << 7);
-	} else {
-		val = dt->tm_year - 1900;
 	}
 	buf[7] = BIN2BCD(val);
 
