Closed dtran11 closed 6 years ago
Sorry for taking so long to sort this out - the bug got lost in my inbox until now.
I think that the sign is correct. The "SecDeviation" is positive when the clock is faster then the expected time and negative when slower. A faster clock (positive value) means that the sign bit is to be cleared. The MCP7940N datasheet explains the formula on page 30.
I believe this line:
int32_t SecDeviation = dt.unixtime()-now().unixtime();
needs to be this:
int32_t SecDeviation = now().unixtime()-dt.unixtime();
So that the sign of the trim is correct.
thanks