]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/sd_journal_get_cutoff_realtime_usec.xml
verify: use manager_load_startable_unit_or_warn() to load units for verification
[thirdparty/systemd.git] / man / sd_journal_get_cutoff_realtime_usec.xml
CommitLineData
b59866ae
LP
1<?xml version='1.0'?> <!--*-nxml-*-->
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
12b42c76 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
b59866ae
LP
4
5<!--
572eb058
ZJS
6 SPDX-License-Identifier: LGPL-2.1+
7
b59866ae
LP
8 This file is part of systemd.
9
10 Copyright 2012 Lennart Poettering
11
12 systemd is free software; you can redistribute it and/or modify it
13 under the terms of the GNU Lesser General Public License as published by
14 the Free Software Foundation; either version 2.1 of the License, or
15 (at your option) any later version.
16
17 systemd is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Lesser General Public License for more details.
21
22 You should have received a copy of the GNU Lesser General Public License
23 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24-->
25
26<refentry id="sd_journal_get_cutoff_realtime_usec">
27
798d3a52
ZJS
28 <refentryinfo>
29 <title>sd_journal_get_cutoff_realtime_usec</title>
30 <productname>systemd</productname>
31
32 <authorgroup>
33 <author>
34 <contrib>Developer</contrib>
35 <firstname>Lennart</firstname>
36 <surname>Poettering</surname>
37 <email>lennart@poettering.net</email>
38 </author>
39 </authorgroup>
40 </refentryinfo>
41
42 <refmeta>
43 <refentrytitle>sd_journal_get_cutoff_realtime_usec</refentrytitle>
44 <manvolnum>3</manvolnum>
45 </refmeta>
46
47 <refnamediv>
48 <refname>sd_journal_get_cutoff_realtime_usec</refname>
49 <refname>sd_journal_get_cutoff_monotonic_usec</refname>
50 <refpurpose>Read cut-off timestamps from the current journal entry</refpurpose>
51 </refnamediv>
52
53 <refsynopsisdiv>
54 <funcsynopsis>
55 <funcsynopsisinfo>#include &lt;systemd/sd-journal.h&gt;</funcsynopsisinfo>
56
57 <funcprototype>
58 <funcdef>int <function>sd_journal_get_cutoff_realtime_usec</function></funcdef>
59 <paramdef>sd_journal *<parameter>j</parameter></paramdef>
60 <paramdef>uint64_t *<parameter>from</parameter></paramdef>
61 <paramdef>uint64_t *<parameter>to</parameter></paramdef>
62 </funcprototype>
63
64 <funcprototype>
65 <funcdef>int <function>sd_journal_get_cutoff_monotonic_usec</function></funcdef>
66 <paramdef>sd_journal *<parameter>j</parameter></paramdef>
67 <paramdef>sd_id128_t <parameter>boot_id</parameter></paramdef>
68 <paramdef>uint64_t *<parameter>from</parameter></paramdef>
69 <paramdef>uint64_t *<parameter>to</parameter></paramdef>
70 </funcprototype>
71
72 </funcsynopsis>
73 </refsynopsisdiv>
74
75 <refsect1>
76 <title>Description</title>
77
78 <para><function>sd_journal_get_cutoff_realtime_usec()</function>
79 retrieves the realtime (wallclock) timestamps of the first and
80 last entries accessible in the journal. It takes three arguments:
81 the journal context object <parameter>j</parameter> and two
82 pointers <parameter>from</parameter> and <parameter>to</parameter>
83 pointing at 64-bit unsigned integers to store the timestamps in.
84 The timestamps are in microseconds since the epoch, i.e.
85 <constant>CLOCK_REALTIME</constant>. Either one of the two
86 timestamp arguments may be passed as <constant>NULL</constant> in
87 case the timestamp is not needed, but not both.</para>
88
89 <para><function>sd_journal_get_cutoff_monotonic_usec()</function>
90 retrieves the monotonic timestamps of the first and last entries
91 accessible in the journal. It takes three arguments: the journal
92 context object <parameter>j</parameter>, a 128-bit identifier for
93 the boot <parameter>boot_id</parameter>, and two pointers to
94 64-bit unsigned integers to store the timestamps,
95 <parameter>from</parameter> and <parameter>to</parameter>. The
96 timestamps are in microseconds since boot-up of the specific boot,
97 i.e. <constant>CLOCK_MONOTONIC</constant>. Since the monotonic
98 clock begins new with every reboot it only defines a well-defined
99 point in time when used together with an identifier identifying
100 the boot, see
101 <citerefentry><refentrytitle>sd_id128_get_boot</refentrytitle><manvolnum>3</manvolnum></citerefentry>
102 for more information. The function will return the timestamps for
103 the boot identified by the passed boot ID. Either one of the two
104 timestamp arguments may be passed as <constant>NULL</constant> in
105 case the timestamp is not needed, but not both.</para>
106 </refsect1>
107
108 <refsect1>
109 <title>Return Value</title>
110
111 <para><function>sd_journal_get_cutoff_realtime_usec()</function>
112 and <function>sd_journal_get_cutoff_monotonic_usec()</function>
113 return 1 on success, 0 if not suitable entries are in the journal
114 or a negative errno-style error code.</para>
115
116 <para>Locations pointed to by parameters
117 <parameter>from</parameter> and <parameter>to</parameter> will be
118 set only if the return value is positive, and obviously, the
119 parameters are non-null.</para>
120 </refsect1>
121
122 <refsect1>
123 <title>Notes</title>
124
a8d46a16
ZJS
125 <para>All functions listed here are thread-agnostic and only a single thread may operate
126 on a given <structname>sd_journal</structname> object.</para>
127
798d3a52
ZJS
128 <para>The
129 <function>sd_journal_get_cutoff_realtime_usec()</function> and
130 <function>sd_journal_get_cutoff_monotonic_usec()</function>
131 interfaces are available as a shared library, which can be
132 compiled and linked to with the
133 <constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
134 file.</para>
135 </refsect1>
136
137 <refsect1>
138 <title>See Also</title>
139
140 <para>
141 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
142 <citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
143 <citerefentry><refentrytitle>sd_journal_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
144 <citerefentry><refentrytitle>sd_journal_get_realtime_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
145 <citerefentry><refentrytitle>sd_id128_get_boot</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
146 <citerefentry><refentrytitle>clock_gettime</refentrytitle><manvolnum>2</manvolnum></citerefentry>
147 </para>
148 </refsect1>
b59866ae
LP
149
150</refentry>