[systemd-devel] looking for an 'uptime' value from a journal entry

Daurnimator quae at daurnimator.com
Wed Feb 25 18:44:46 PST 2015


On 25 February 2015 at 20:50, Chris Morgan <chmorgan at gmail.com> wrote:

> From
> http://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html#__MONOTONIC_TIMESTAMP=
> it looks like __MONOTONIC_TIMESTAMP might be just what I'm looking for
> but the information at the start of that section has me wondering if I
> can rely on this __MONOTONIC_TIMESTAMP being present for all entries
> and use this as the system uptime.
>

Those three fields will always be present.
They are not *in* the data, but metadata kept for every journal entry.
At the libsystemd level, you access them via their own apis, see
http://www.freedesktop.org/software/systemd/man/sd_journal_get_cutoff_monotonic_usec.html

Please refer to `man 2 clock_gettime` on whether CLOCK_MONOTONIC suits your
needs for an 'uptime' clock.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150225/239e4a63/attachment.html>


More information about the systemd-devel mailing list