Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 2691
b: refs/heads/master
c: 0b46e33
h: refs/heads/master
i:
  2689: 51c96f2
  2687: fb4d3fd
v: v3
  • Loading branch information
Ladislav Michl authored and Greg Kroah-Hartman committed Jun 22, 2005
1 parent d1c0a83 commit c472beb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d01b79d0613ebb6810bb48baf6e53e9319701fea
refs/heads/master: 0b46e334d77b2d3b8b3aa665c81c4afbe9f1f458
13 changes: 6 additions & 7 deletions trunk/drivers/i2c/chips/ds1337.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_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;

Expand Down Expand Up @@ -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[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);

Expand Down

0 comments on commit c472beb

Please sign in to comment.