sd_journal_get_cutoff_realtime_usec.xml revision 1651e2c61e544de9ca947c8b3202552b1272ef57
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier This file is part of systemd.
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier Copyright 2012 Lennart Poettering
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier systemd is free software; you can redistribute it and/or modify it
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier under the terms of the GNU Lesser General Public License as published by
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier the Free Software Foundation; either version 2.1 of the License, or
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier (at your option) any later version.
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier systemd is distributed in the hope that it will be useful, but
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier WITHOUT ANY WARRANTY; without even the implied warranty of
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier Lesser General Public License for more details.
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier You should have received a copy of the GNU Lesser General Public License
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier along with systemd; If not, see <http://www.gnu.org/licenses/>.
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier<refentry id="sd_journal_get_cutoff_realtime_usec">
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <refentryinfo>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <title>sd_journal_get_cutoff_realtime_usec</title>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <authorgroup>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier </authorgroup>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier </refentryinfo>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <refentrytitle>sd_journal_get_cutoff_realtime_usec</refentrytitle>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <refname>sd_journal_get_cutoff_realtime_usec</refname>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <refname>sd_journal_get_cutoff_monotonic_usec</refname>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <refpurpose>Read cut-off timestamps from the current journal entry</refpurpose>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier </refnamediv>
cda134ab1eac84f874aacf8e885a07112a7fd5ceLennart Poettering <refsynopsisdiv>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <funcsynopsis>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <funcsynopsisinfo>#include <systemd/sd-journal.h></funcsynopsisinfo>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <funcprototype>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <funcdef>int <function>sd_journal_get_cutoff_realtime_usec</function></funcdef>
cda134ab1eac84f874aacf8e885a07112a7fd5ceLennart Poettering <paramdef>sd_journal *<parameter>j</parameter></paramdef>
cda134ab1eac84f874aacf8e885a07112a7fd5ceLennart Poettering <paramdef>uint64_t *<parameter>from</parameter></paramdef>
cda134ab1eac84f874aacf8e885a07112a7fd5ceLennart Poettering <paramdef>uint64_t *<parameter>to</parameter></paramdef>
cda134ab1eac84f874aacf8e885a07112a7fd5ceLennart Poettering </funcprototype>
cda134ab1eac84f874aacf8e885a07112a7fd5ceLennart Poettering <funcprototype>
cda134ab1eac84f874aacf8e885a07112a7fd5ceLennart Poettering <funcdef>int <function>sd_journal_get_cutoff_monotonic_usec</function></funcdef>
cda134ab1eac84f874aacf8e885a07112a7fd5ceLennart Poettering <paramdef>sd_journal *<parameter>j</parameter></paramdef>
cda134ab1eac84f874aacf8e885a07112a7fd5ceLennart Poettering <paramdef>sd_id128_t <parameter>boot_id</parameter></paramdef>
cda134ab1eac84f874aacf8e885a07112a7fd5ceLennart Poettering <paramdef>uint64_t *<parameter>from</parameter></paramdef>
cda134ab1eac84f874aacf8e885a07112a7fd5ceLennart Poettering <paramdef>uint64_t *<parameter>to</parameter></paramdef>
cda134ab1eac84f874aacf8e885a07112a7fd5ceLennart Poettering </funcprototype>
cda134ab1eac84f874aacf8e885a07112a7fd5ceLennart Poettering </funcsynopsis>
cda134ab1eac84f874aacf8e885a07112a7fd5ceLennart Poettering </refsynopsisdiv>
cda134ab1eac84f874aacf8e885a07112a7fd5ceLennart Poettering <para><function>sd_journal_get_cutoff_realtime_usec()</function>
cda134ab1eac84f874aacf8e885a07112a7fd5ceLennart Poettering retrieves the realtime (wallclock) timestamps of the
cda134ab1eac84f874aacf8e885a07112a7fd5ceLennart Poettering first and last entries accessible in the journal. It
cda134ab1eac84f874aacf8e885a07112a7fd5ceLennart Poettering takes three arguments: the journal context object
cda134ab1eac84f874aacf8e885a07112a7fd5ceLennart Poettering <parameter>j</parameter> and two pointers
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <parameter>to</parameter> pointing at 64-bit unsigned
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier integers to store the timestamps in. The timestamps
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier are in microseconds since the epoch,
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier i.e. <constant>CLOCK_REALTIME</constant>. Either one
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier of the two timestamp arguments may be passed as
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <constant>NULL</constant> in case the timestamp is not
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier needed, but not both.</para>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <para><function>sd_journal_get_cutoff_monotonic_usec()</function>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier retrieves the monotonic timestamps of the first and
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier last entries accessible in the journal. It takes three
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier arguments: the journal context object
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <parameter>j</parameter>, a 128-bit identifier for the
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier boot <parameter>boot_id</parameter>, and two pointers
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier to 64-bit unsigned integers to store the timestamps,
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <parameter>to</parameter>. The timestamps are in
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier microseconds since boot-up of the specific boot,
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier i.e. <constant>CLOCK_MONOTONIC</constant>. Since the
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier monotonic clock begins new with every reboot it only
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier defines a well-defined point in time when used
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier together with an identifier identifying the boot, see
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <citerefentry><refentrytitle>sd_id128_get_boot</refentrytitle><manvolnum>3</manvolnum></citerefentry>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier for more information. The function will return the
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier timestamps for the boot identified by the passed boot
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier ID. Either one of the two timestamp arguments may be
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier passed as <constant>NULL</constant> in case the
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier timestamp is not needed, but not both.</para>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <para><function>sd_journal_get_cutoff_realtime_usec()</function>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <function>sd_journal_get_cutoff_monotonic_usec()</function>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier return 1 on success, 0 if not suitable entries are in
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier the journal or a negative errno-style error code.</para>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <para>Locations pointed to by parameters
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <parameter>to</parameter> will be set only if the
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier return value is positive, and obviously, the
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier parameters are non-null.</para>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <function>sd_journal_get_cutoff_realtime_usec()</function>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier <function>sd_journal_get_cutoff_monotonic_usec()</function>
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier interfaces are available as a shared library, which can
641d1f99b8c4c5427a1fedcb4740586a130ac6cfRonny Chevalier be compiled and linked to with the
cda134ab1eac84f874aacf8e885a07112a7fd5ceLennart Poettering <constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
<citerefentry><refentrytitle>sd_journal_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_journal_get_realtime_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>,