[systemd-devel] systemd-timesync and journalctl questions
Mantas Mikulėnas
grawity at gmail.com
Sat Sep 15 12:28:22 UTC 2018
On Sat, Sep 15, 2018 at 3:02 PM D.S. Ljungmark <ljungmark at modio.se> wrote:
> I’ve got a follow up here. We want code to run both before and after time
> is synchronized the first time. But we -also- need to know how big the
> first time jump is.
> It’s lokel to be in the matter of weeks or months in our application, and
> we’d want to know how much it was lagging.
> We start logging measurements before things are connected, and tag them as
> unknown, later when we get an application sync on time we can recalculate
> to proper dates,( provided we weren’t losing power for many times before
> we get a network sync)
>
AFAIK you could look at the difference between real time and CLOCK_BOOTTIME
(or MONOTONIC). Whenever you notice the clock jumping, compare the new
difference with the previously seen one, and you'll know how much to offset
the old records by. That doesn't depend on any external software and works
just as well with timesyncd as it does with ntpdate or manual adjustments.
(For example, every journald entry includes the real-time *and* monotonic
timestamps.)
--
Mantas Mikulėnas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180915/9410b95b/attachment.html>
More information about the systemd-devel
mailing list