]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_journal_get_realtime_usec.xml
tree-wide: remove Lennart's copyright lines
[thirdparty/systemd.git] / man / sd_journal_get_realtime_usec.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6 SPDX-License-Identifier: LGPL-2.1+
7 -->
8
9 <refentry id="sd_journal_get_realtime_usec"
10 xmlns:xi="http://www.w3.org/2001/XInclude">
11
12 <refentryinfo>
13 <title>sd_journal_get_realtime_usec</title>
14 <productname>systemd</productname>
15
16 <authorgroup>
17 <author>
18 <contrib>Developer</contrib>
19 <firstname>Lennart</firstname>
20 <surname>Poettering</surname>
21 <email>lennart@poettering.net</email>
22 </author>
23 </authorgroup>
24 </refentryinfo>
25
26 <refmeta>
27 <refentrytitle>sd_journal_get_realtime_usec</refentrytitle>
28 <manvolnum>3</manvolnum>
29 </refmeta>
30
31 <refnamediv>
32 <refname>sd_journal_get_realtime_usec</refname>
33 <refname>sd_journal_get_monotonic_usec</refname>
34 <refpurpose>Read timestamps from the current journal entry</refpurpose>
35 </refnamediv>
36
37 <refsynopsisdiv>
38 <funcsynopsis>
39 <funcsynopsisinfo>#include &lt;systemd/sd-journal.h&gt;</funcsynopsisinfo>
40
41 <funcprototype>
42 <funcdef>int <function>sd_journal_get_realtime_usec</function></funcdef>
43 <paramdef>sd_journal *<parameter>j</parameter></paramdef>
44 <paramdef>uint64_t *<parameter>usec</parameter></paramdef>
45 </funcprototype>
46
47 <funcprototype>
48 <funcdef>int <function>sd_journal_get_monotonic_usec</function></funcdef>
49 <paramdef>sd_journal *<parameter>j</parameter></paramdef>
50 <paramdef>uint64_t *<parameter>usec</parameter></paramdef>
51 <paramdef>sd_id128_t *<parameter>boot_id</parameter></paramdef>
52 </funcprototype>
53
54 </funcsynopsis>
55 </refsynopsisdiv>
56
57 <refsect1>
58 <title>Description</title>
59
60 <para><function>sd_journal_get_realtime_usec()</function> gets the
61 realtime (wallclock) timestamp of the current journal entry. It
62 takes two arguments: the journal context object and a pointer to a
63 64-bit unsigned integer to store the timestamp in. The timestamp
64 is in microseconds since the epoch, i.e.
65 <constant>CLOCK_REALTIME</constant>.</para>
66
67 <para><function>sd_journal_get_monotonic_usec()</function> gets
68 the monotonic timestamp of the current journal entry. It takes
69 three arguments: the journal context object, a pointer to a 64-bit
70 unsigned integer to store the timestamp in, as well as a 128-bit
71 ID buffer to store the boot ID of the monotonic timestamp. The
72 timestamp is in microseconds since boot-up of the specific boot,
73 i.e. <constant>CLOCK_MONOTONIC</constant>. Since the monotonic
74 clock begins new with every reboot, it only defines a well-defined
75 point in time when used together with an identifier identifying
76 the boot. See
77 <citerefentry><refentrytitle>sd_id128_get_boot</refentrytitle><manvolnum>3</manvolnum></citerefentry>
78 for more information. If the boot ID parameter is passed
79 <constant>NULL</constant>, the function will fail if the monotonic
80 timestamp of the current entry is not of the current system
81 boot.</para>
82
83 <para>Note that these functions will not work before
84 <citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry>
85 (or related call) has been called at least
86 once, in order to position the read pointer at a valid entry.</para>
87 </refsect1>
88
89 <refsect1>
90 <title>Return Value</title>
91
92 <para><function>sd_journal_get_realtime_usec()</function> and
93 <function>sd_journal_get_monotonic_usec()</function> returns 0 on
94 success or a negative errno-style error code. If the boot ID
95 parameter was passed <constant>NULL</constant> and the monotonic
96 timestamp of the current journal entry is not of the current
97 system boot, <constant>-ESTALE</constant> is returned by
98 <function>sd_journal_get_monotonic_usec()</function>.</para>
99 </refsect1>
100
101 <xi:include href="libsystemd-pkgconfig.xml" />
102
103 <refsect1>
104 <title>See Also</title>
105
106 <para>
107 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
108 <citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
109 <citerefentry><refentrytitle>sd_journal_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
110 <citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
111 <citerefentry><refentrytitle>sd_journal_get_data</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
112 <citerefentry><refentrytitle>sd_id128_get_boot</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
113 <citerefentry><refentrytitle>clock_gettime</refentrytitle><manvolnum>2</manvolnum></citerefentry>,
114 <citerefentry><refentrytitle>sd_journal_get_cutoff_realtime_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>
115 </para>
116 </refsect1>
117
118 </refentry>