Commit 0b46e334 authored by Ladislav Michl's avatar Ladislav Michl Committed by Greg Kroah-Hartman

[PATCH] I2C: ds1337: Make time format consistent with other RTC drivers

Make time format consistent with other RTC drivers.
Signed-off-by: default avatarLadislav Michl <ladis@linux-mips.org>
Signed-off-by: default avatarJames Chapman <jchapman@katalix.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d01b79d0
...@@ -130,8 +130,8 @@ static int ds1337_get_datetime(struct i2c_client *client, struct rtc_time *dt) ...@@ -130,8 +130,8 @@ static int ds1337_get_datetime(struct i2c_client *client, struct rtc_time *dt)
dt->tm_wday = BCD2BIN(buf[3]) - 1; dt->tm_wday = BCD2BIN(buf[3]) - 1;
dt->tm_mday = BCD2BIN(buf[4]); dt->tm_mday = BCD2BIN(buf[4]);
val = buf[5] & 0x7f; val = buf[5] & 0x7f;
dt->tm_mon = BCD2BIN(val); dt->tm_mon = BCD2BIN(val) - 1;
dt->tm_year = 1900 + BCD2BIN(buf[6]); dt->tm_year = BCD2BIN(buf[6]);
if (buf[5] & 0x80) if (buf[5] & 0x80)
dt->tm_year += 100; dt->tm_year += 100;
...@@ -171,12 +171,11 @@ static int ds1337_set_datetime(struct i2c_client *client, struct rtc_time *dt) ...@@ -171,12 +171,11 @@ static int ds1337_set_datetime(struct i2c_client *client, struct rtc_time *dt)
buf[3] = BIN2BCD(dt->tm_hour) | (1 << 6); buf[3] = BIN2BCD(dt->tm_hour) | (1 << 6);
buf[4] = BIN2BCD(dt->tm_wday) + 1; buf[4] = BIN2BCD(dt->tm_wday) + 1;
buf[5] = BIN2BCD(dt->tm_mday); buf[5] = BIN2BCD(dt->tm_mday);
buf[6] = BIN2BCD(dt->tm_mon); buf[6] = BIN2BCD(dt->tm_mon) + 1;
if (dt->tm_year >= 2000) { val = dt->tm_year;
val = dt->tm_year - 2000; if (val >= 100) {
val -= 100;
buf[6] |= (1 << 7); buf[6] |= (1 << 7);
} else {
val = dt->tm_year - 1900;
} }
buf[7] = BIN2BCD(val); buf[7] = BIN2BCD(val);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment