thorrak / tiltbridge

Tilt Hydrometer to WiFi Bridge
http://www.tiltbridge.com/
Other
61 stars 27 forks source link

MQTT Timestamp Invalid #193

Open lbussy opened 3 years ago

lbussy commented 3 years ago

Reported by postalbunny via PM on HBT:

{"Color":"Orange","timeStamp":1839,"fermunits":"SG","SG":"1.0260","Temp":"74.0","tempunits":"F"}
{"Color":"Orange","timeStamp":1869,"fermunits":"SG","SG":"1.0260","Temp":"74.0","tempunits":"F"}
{"Color":"Orange","timeStamp":1899,"fermunits":"SG","SG":"1.0260","Temp":"74.0","tempunits":"F"}
{"Color":"Orange","timeStamp":1930,"fermunits":"SG","SG":"1.0260","Temp":"74.0","tempunits":"F"}

I think this is actually a count-up from power on and that we're not really tracking time. I'm wondering if we should change "timestamp" to "uptime" or provide the actual timestamp. Someone mapping the mqtt may try to convert the timestamp from "epoch" and get some weird dates.

It is in fact only millis() wrapped up in `std::time(0):

https://github.com/thorrak/tiltbridge/blob/f0ed2cfd0ad45a1b3f4dcac845e7de1732db4564/src/sendData.cpp#L631

thorrak commented 2 years ago

As this is theoretically a breaking change, deferring this to a future version.