Skip to content

Commit a190bc5

Browse files
authored
Merge pull request #1 from afaonline/afaonline-patch-1
Fixed year calculation due to operator precedence
2 parents bcc2d62 + e181338 commit a190bc5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ds1302.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ def write_datetime(self, dt):
9393
byte_l[3] = (dt.tm_mday // 10) << 4 | dt.tm_mday % 10
9494
byte_l[4] = (dt.tm_mon // 10) << 4 | dt.tm_mon % 10
9595
byte_l[5] = 0
96-
byte_l[6] = ((dt.tm_year-2000 // 10) << 4) | (dt.tm_year-2000) % 10
96+
byte_l[6] = (((dt.tm_year-2000) // 10) << 4) | (dt.tm_year-2000) % 10
9797
self._start_tx()
9898
self._w_byte(0xbe)
9999
for byte in byte_l:
100100
self._w_byte(byte)
101-
self._end_tx()
101+
self._end_tx()

0 commit comments

Comments
 (0)