]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_journal_get_realtime_usec.xml
man: mention that RestrictNamespaces= can be specified multiple times
[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 This file is part of systemd.
9
10 Copyright 2012 Lennart Poettering
11 -->
12
13 <refentry id="sd_journal_get_realtime_usec">
14
15 <refentryinfo>
16 <title>sd_journal_get_realtime_usec</title>
17 <productname>systemd</productname>
18
19 <authorgroup>
20 <author>
21 <contrib>Developer</contrib>
22 <firstname>Lennart</firstname>
23 <surname>Poettering</surname>
24 <email>lennart@poettering.net</email>
25 </author>
26 </authorgroup>
27 </refentryinfo>
28
29 <refmeta>
30 <refentrytitle>sd_journal_get_realtime_usec</refentrytitle>
31 <manvolnum>3</manvolnum>
32 </refmeta>
33
34 <refnamediv>
35 <refname>sd_journal_get_realtime_usec</refname>
36 <refname>sd_journal_get_monotonic_usec</refname>
37 <refpurpose>Read timestamps from the current journal entry</refpurpose>
38 </refnamediv>
39
40 <refsynopsisdiv>
41 <funcsynopsis>
42 <funcsynopsisinfo>#include &lt;systemd/sd-journal.h&gt;</funcsynopsisinfo>
43
44 <funcprototype>
45 <funcdef>int <function>sd_journal_get_realtime_usec</function></funcdef>
46 <paramdef>sd_journal *<parameter>j</parameter></paramdef>
47 <paramdef>uint64_t *<parameter>usec</parameter></paramdef>
48 </funcprototype>
49
50 <funcprototype>
51 <funcdef>int <function>sd_journal_get_monotonic_usec</function></funcdef>
52 <paramdef>sd_journal *<parameter>j</parameter></paramdef>
53 <paramdef>uint64_t *<parameter>usec</parameter></paramdef>
54 <paramdef>sd_id128_t *<parameter>boot_id</parameter></paramdef>
55 </funcprototype>
56
57 </funcsynopsis>
58 </refsynopsisdiv>
59
60 <refsect1>
61 <title>Description</title>
62
63 <para><function>sd_journal_get_realtime_usec()</function> gets the
64 realtime (wallclock) timestamp of the current journal entry. It
65 takes two arguments: the journal context object and a pointer to a
66 64-bit unsigned integer to store the timestamp in. The timestamp
67 is in microseconds since the epoch, i.e.
68 <constant>CLOCK_REALTIME</constant>.</para>
69
70 <para><function>sd_journal_get_monotonic_usec()</function> gets
71 the monotonic timestamp of the current journal entry. It takes
72 three arguments: the journal context object, a pointer to a 64-bit
73 unsigned integer to store the timestamp in, as well as a 128-bit
74 ID buffer to store the boot ID of the monotonic timestamp. The
75 timestamp is in microseconds since boot-up of the specific boot,
76 i.e. <constant>CLOCK_MONOTONIC</constant>. Since the monotonic
77 clock begins new with every reboot, it only defines a well-defined
78 point in time when used together with an identifier identifying
79 the boot. See
80 <citerefentry><refentrytitle>sd_id128_get_boot</refentrytitle><manvolnum>3</manvolnum></citerefentry>
81 for more information. If the boot ID parameter is passed
82 <constant>NULL</constant>, the function will fail if the monotonic
83 timestamp of the current entry is not of the current system
84 boot.</para>
85
86 <para>Note that these functions will not work before
87 <citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry>
88 (or related call) has been called at least
89 once, in order to position the read pointer at a valid entry.</para>
90 </refsect1>
91
92 <refsect1>
93 <title>Return Value</title>
94
95 <para><function>sd_journal_get_realtime_usec()</function> and
96 <function>sd_journal_get_monotonic_usec()</function> returns 0 on
97 success or a negative errno-style error code. If the boot ID
98 parameter was passed <constant>NULL</constant> and the monotonic
99 timestamp of the current journal entry is not of the current
100 system boot, <constant>-ESTALE</constant> is returned by
101 <function>sd_journal_get_monotonic_usec()</function>.</para>
102 </refsect1>
103
104 <refsect1>
105 <title>Notes</title>
106
107 <para>The <function>sd_journal_get_realtime_usec()</function> and
108 <function>sd_journal_get_monotonic_usec()</function> interfaces
109 are available as a shared library, which can be compiled and
110 linked to with the
111 <constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
112 file.</para>
113 </refsect1>
114
115 <refsect1>
116 <title>See Also</title>
117
118 <para>
119 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
120 <citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
121 <citerefentry><refentrytitle>sd_journal_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
122 <citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
123 <citerefentry><refentrytitle>sd_journal_get_data</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
124 <citerefentry><refentrytitle>sd_id128_get_boot</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
125 <citerefentry><refentrytitle>clock_gettime</refentrytitle><manvolnum>2</manvolnum></citerefentry>,
126 <citerefentry><refentrytitle>sd_journal_get_cutoff_realtime_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>
127 </para>
128 </refsect1>
129
130 </refentry>