| 1 |
<?xml version='1.0'?> <!--*-nxml-*--> |
| 2 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 3 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
| 4 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 5 |
|
| 6 |
<refentry id="sd_journal_get_cutoff_realtime_usec" xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 7 |
|
| 8 |
<refentryinfo> |
| 9 |
<title>sd_journal_get_cutoff_realtime_usec</title> |
| 10 |
<productname>systemd</productname> |
| 11 |
</refentryinfo> |
| 12 |
|
| 13 |
<refmeta> |
| 14 |
<refentrytitle>sd_journal_get_cutoff_realtime_usec</refentrytitle> |
| 15 |
<manvolnum>3</manvolnum> |
| 16 |
</refmeta> |
| 17 |
|
| 18 |
<refnamediv> |
| 19 |
<refname>sd_journal_get_cutoff_realtime_usec</refname> |
| 20 |
<refname>sd_journal_get_cutoff_monotonic_usec</refname> |
| 21 |
<refpurpose>Read cut-off timestamps from the current journal entry</refpurpose> |
| 22 |
</refnamediv> |
| 23 |
|
| 24 |
<refsynopsisdiv> |
| 25 |
<funcsynopsis> |
| 26 |
<funcsynopsisinfo>#include <systemd/sd-journal.h></funcsynopsisinfo> |
| 27 |
|
| 28 |
<funcprototype> |
| 29 |
<funcdef>int <function>sd_journal_get_cutoff_realtime_usec</function></funcdef> |
| 30 |
<paramdef>sd_journal *<parameter>j</parameter></paramdef> |
| 31 |
<paramdef>uint64_t *<parameter>from</parameter></paramdef> |
| 32 |
<paramdef>uint64_t *<parameter>to</parameter></paramdef> |
| 33 |
</funcprototype> |
| 34 |
|
| 35 |
<funcprototype> |
| 36 |
<funcdef>int <function>sd_journal_get_cutoff_monotonic_usec</function></funcdef> |
| 37 |
<paramdef>sd_journal *<parameter>j</parameter></paramdef> |
| 38 |
<paramdef>sd_id128_t <parameter>boot_id</parameter></paramdef> |
| 39 |
<paramdef>uint64_t *<parameter>from</parameter></paramdef> |
| 40 |
<paramdef>uint64_t *<parameter>to</parameter></paramdef> |
| 41 |
</funcprototype> |
| 42 |
|
| 43 |
</funcsynopsis> |
| 44 |
</refsynopsisdiv> |
| 45 |
|
| 46 |
<refsect1> |
| 47 |
<title>Description</title> |
| 48 |
|
| 49 |
<para><function>sd_journal_get_cutoff_realtime_usec()</function> |
| 50 |
retrieves the realtime (wallclock) timestamps of the first and |
| 51 |
last entries accessible in the journal. It takes three arguments: |
| 52 |
the journal context object <parameter>j</parameter> and two |
| 53 |
pointers <parameter>from</parameter> and <parameter>to</parameter> |
| 54 |
pointing at 64-bit unsigned integers to store the timestamps in. |
| 55 |
The timestamps are in microseconds since the epoch, i.e. |
| 56 |
<constant>CLOCK_REALTIME</constant>. Either one of the two |
| 57 |
timestamp arguments may be passed as <constant>NULL</constant> in |
| 58 |
case the timestamp is not needed, but not both.</para> |
| 59 |
|
| 60 |
<para><function>sd_journal_get_cutoff_monotonic_usec()</function> |
| 61 |
retrieves the monotonic timestamps of the first and last entries |
| 62 |
accessible in the journal. It takes three arguments: the journal |
| 63 |
context object <parameter>j</parameter>, a 128-bit identifier for |
| 64 |
the boot <parameter>boot_id</parameter>, and two pointers to |
| 65 |
64-bit unsigned integers to store the timestamps, |
| 66 |
<parameter>from</parameter> and <parameter>to</parameter>. The |
| 67 |
timestamps are in microseconds since boot-up of the specific boot, |
| 68 |
i.e. <constant>CLOCK_MONOTONIC</constant>. Since the monotonic |
| 69 |
clock begins new with every reboot it only defines a well-defined |
| 70 |
point in time when used together with an identifier identifying |
| 71 |
the boot, see |
| 72 |
<citerefentry><refentrytitle>sd_id128_get_boot</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
| 73 |
for more information. The function will return the timestamps for |
| 74 |
the boot identified by the passed boot ID. Either one of the two |
| 75 |
timestamp arguments may be passed as <constant>NULL</constant> in |
| 76 |
case the timestamp is not needed, but not both.</para> |
| 77 |
</refsect1> |
| 78 |
|
| 79 |
<refsect1> |
| 80 |
<title>Return Value</title> |
| 81 |
|
| 82 |
<para><function>sd_journal_get_cutoff_realtime_usec()</function> |
| 83 |
and <function>sd_journal_get_cutoff_monotonic_usec()</function> |
| 84 |
return 1 on success, 0 if not suitable entries are in the journal |
| 85 |
or a negative errno-style error code.</para> |
| 86 |
|
| 87 |
<para>Locations pointed to by parameters |
| 88 |
<parameter>from</parameter> and <parameter>to</parameter> will be |
| 89 |
set only if the return value is positive, and obviously, the |
| 90 |
parameters are non-null.</para> |
| 91 |
</refsect1> |
| 92 |
|
| 93 |
<refsect1> |
| 94 |
<title>Notes</title> |
| 95 |
|
| 96 |
<xi:include href="threads-aware.xml" xpointer="strict" /> |
| 97 |
|
| 98 |
<xi:include href="libsystemd-pkgconfig.xml" xpointer="pkgconfig-text"/> |
| 99 |
</refsect1> |
| 100 |
|
| 101 |
<refsect1> |
| 102 |
<title>History</title> |
| 103 |
<para><function>sd_journal_get_cutoff_realtime_usec()</function> and |
| 104 |
<function>sd_journal_get_cutoff_monotonic_usec()</function> were added in version 187.</para> |
| 105 |
</refsect1> |
| 106 |
|
| 107 |
<refsect1> |
| 108 |
<title>See Also</title> |
| 109 |
|
| 110 |
<para><simplelist type="inline"> |
| 111 |
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 112 |
<member><citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 113 |
<member><citerefentry><refentrytitle>sd_journal_open</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 114 |
<member><citerefentry><refentrytitle>sd_journal_get_realtime_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 115 |
<member><citerefentry><refentrytitle>sd_id128_get_boot</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 116 |
<member><citerefentry><refentrytitle>clock_gettime</refentrytitle><manvolnum>2</manvolnum></citerefentry></member> |
| 117 |
</simplelist></para> |
| 118 |
</refsect1> |
| 119 |
|
| 120 |
</refentry> |