Fix the vtpro datetime parsing
For the BCD encoded day field (range 1-31), two bits are sufficient to represent the upper digit (range 0-3). The purpose of the highest bit is unknown, but it's certainly not part of the day field, and needs to be masked off.
This commit is contained in:
parent
f65e3cf39e
commit
ba96b3092d
@ -129,7 +129,7 @@ oceanic_vtpro_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetim
|
|||||||
else
|
else
|
||||||
datetime->year = bcd2dec (((p[32 + 3] & 0xC0) >> 2) + ((p[32 + 2] & 0xF0) >> 4)) + 2000;
|
datetime->year = bcd2dec (((p[32 + 3] & 0xC0) >> 2) + ((p[32 + 2] & 0xF0) >> 4)) + 2000;
|
||||||
datetime->month = (p[4] & 0xF0) >> 4;
|
datetime->month = (p[4] & 0xF0) >> 4;
|
||||||
datetime->day = bcd2dec (p[3]);
|
datetime->day = bcd2dec (p[3] & 0x7F);
|
||||||
datetime->hour = bcd2dec (p[1] & 0x7F);
|
datetime->hour = bcd2dec (p[1] & 0x7F);
|
||||||
pm = p[1] & 0x80;
|
pm = p[1] & 0x80;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user