I am trying to fix the following problem:
If a device is down for x hours due to power cutoff and then boots up when the power is up, it takes some minutes to get internet up and time synced with chronyc. I am using the device as a sensor data collector that marks data with a timestamp before sending it to my cloud. This introduces a wrong timestamp on the data points that are read and sent before internet connection is up. (Those messages would then have a timestamp of the device’s last boot session time+local clock time.)
What is the best way to know if the device has synced its time successfully since the last boot, and then get the difference in time and modify the wrong timestamp?
As I want to be able to buffer sensor data locally when the device is offline, choosing to wait for internet connection is not an option for me.
Thanks in advance