it can happen that a pwnagotchi is only restarted after several days and gets internet synchronization after several hours.
in these hours all stored timestamps are wrong.
for this an idea like these wrong timestamps, e.g. with stored net-pos data afterwards could be corrected:
boot-uuid: 1d234f45 << uuid created on every boot
boot-uptime: 13.31s << uptime at save boot-ts
boot-ts: 1571227347 << system time
sync-uptime: 1839.23s << uptime on timesync/ntp sync or NULL
synced-ts: 1571227538 << new synced timestamp
what do you think?
Did I miss something?
i'm a bit worried about the "must not miss any time sync" part
i'm a bit worried about the "must not miss any time sync" part
because i dont know in what ways the raspbian is syncing the time.
ntp, gps-time, ???
but after thinking about:
no hook needed, if the time was changed/synced and changed with e.g. over 1 minute offset, it was synced and can be set to "synced"
i will try to code this on weekend.
is related to #308
As far as i know systemd-timesyncd is doing the synchronisation.
Also, systemd-timesyncd touches /var/lib/systemd/clock, when the sync happened.
nice, and the boot-uuid are there too: md5(/var/lib/systemd/random-seed)
first test looks good, time offset is correct calculated after time synced with over 60seconds offset.
but needs more time to be finished+integrated - i think not as plugin, it needs to be in core.
https://github.com/xenDE/pwnagotchi-plugin-timesync
everybody welcome: https://github.com/xenDE/pwnagotchi-plugin-timesync
i added a test, and it looks working.
https://github.com/xenDE/pwnagotchi-plugin-timesync
for test:
an RTC is a cheap and easy solution:
Most helpful comment
i'm a bit worried about the "must not miss any time sync" part