Curious if anyone knows how to decode Log Entry Date into an actual Gregorian date?
Somehow these bytes -- 89, 42 -- correspond to 2021-09-05. And these bytes -- 8, 43 -- to 2021-08-17.
At first I thought it was maybe an epoch offset...but the epoch would have been at some point in 1991, so I'm probably chasing the rabbit down the wrong hole w/ that approach. Unless the firmware developer used their first born's birthday as the epoch?!
Decoding BLE log entry date bytes
-
- Paddler
- Posts: 33
- Joined: October 30th, 2015, 11:10 pm
Re: Decoding BLE log entry date bytes
I think this is what you're after:
From https://github.com/ergarcade/pm5-detail ... es.js#L146
Code: Select all
logDate: function(n) {
let month = n & 0x0f; /* bits 0 to 3 */
let day = (n >> 4) & 0x1f; /* bits 4 to 8 */
let year = 2000 + ((n >> 9) & 0x7f); /* bits 9 to 13 (15); epoch is 2000 */
return day + "/" + month + "/" + year;
},
Male, 46, 5'11", 100kg, log.
Re: Decoding BLE log entry date bytes
Gorgeous, thank you!
Re: Decoding BLE log entry date bytes
Turns out we were both investigating this around the same time - wish I had seen this sooner.
I ended up making a diagram for the bit layout to help map each bit/byte's value to the words concept2 uses in their spec when talking about piece timestamps (the bold text on the left). Initially I was assuming the boundary between day and year was on the byte boundary, but then my year values were incorrect once 2022 rolled around. In case the diagram is confusing, the order bits are sent over the wire goes from right to left starting at the top row and working down
I ended up making a diagram for the bit layout to help map each bit/byte's value to the words concept2 uses in their spec when talking about piece timestamps (the bold text on the left). Initially I was assuming the boundary between day and year was on the byte boundary, but then my year values were incorrect once 2022 rolled around. In case the diagram is confusing, the order bits are sent over the wire goes from right to left starting at the top row and working down
Re: Decoding BLE log entry date bytes
This is great!moralcode wrote: ↑February 13th, 2022, 12:03 amTurns out we were both investigating this around the same time - wish I had seen this sooner.
I ended up making a diagram for the bit layout to help map each bit/byte's value to the words concept2 uses in their spec when talking about piece timestamps (the bold text on the left). Initially I was assuming the boundary between day and year was on the byte boundary, but then my year values were incorrect once 2022 rolled around. In case the diagram is confusing, the order bits are sent over the wire goes from right to left starting at the top row and working down