]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_journal_get_realtime_usec.xml
Revert "build-sys: substitute strings in systemd.unit(5)"
[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 This file is part of systemd.
7
8 Copyright 2012 Lennart Poettering
9
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 -->
23
24 <refentry id="sd_journal_get_realtime_usec">
25
26 <refentryinfo>
27 <title>sd_journal_get_realtime_usec</title>
28 <productname>systemd</productname>
29
30 <authorgroup>
31 <author>
32 <contrib>Developer</contrib>
33 <firstname>Lennart</firstname>
34 <surname>Poettering</surname>
35 <email>lennart@poettering.net</email>
36 </author>
37 </authorgroup>
38 </refentryinfo>
39
40 <refmeta>
41 <refentrytitle>sd_journal_get_realtime_usec</refentrytitle>
42 <manvolnum>3</manvolnum>
43 </refmeta>
44
45 <refnamediv>
46 <refname>sd_journal_get_realtime_usec</refname>
47 <refname>sd_journal_get_monotonic_usec</refname>
48 <refpurpose>Read timestamps from the current journal entry</refpurpose>
49 </refnamediv>
50
51 <refsynopsisdiv>
52 <funcsynopsis>
53 <funcsynopsisinfo>#include &lt;systemd/sd-journal.h&gt;</funcsynopsisinfo>
54
55 <funcprototype>
56 <funcdef>int <function>sd_journal_get_realtime_usec</function></funcdef>
57 <paramdef>sd_journal* <parameter>j</parameter></paramdef>
58 <paramdef>uint64_t* <parameter>usec</parameter></paramdef>
59 </funcprototype>
60
61 <funcprototype>
62 <funcdef>int <function>sd_journal_get_monotonic_usec</function></funcdef>
63 <paramdef>sd_journal* <parameter>j</parameter></paramdef>
64 <paramdef>uint64_t* <parameter>usec</parameter></paramdef>
65 <paramdef>sd_id128_t* <parameter>boot_id</parameter></paramdef>
66 </funcprototype>
67
68 </funcsynopsis>
69 </refsynopsisdiv>
70
71 <refsect1>
72 <title>Description</title>
73
74 <para><function>sd_journal_get_realtime_usec()</function>
75 gets the realtime (wallclock) timestamp of the
76 current journal entry. It takes two arguments: the
77 journal context object and a pointer to a 64 Bit
78 unsigned integer to store the timestamp in. The
79 timestamp is in microseconds since the epoch,
80 i.e. CLOCK_REALTIME.</para>
81
82 <para><function>sd_journal_get_monotonic_usec()</function>
83 gets the monotonic timestamp of the current
84 journal entry. It takes three arguments: the journal
85 context object, a pointer to a 64 Bit unsigned integer
86 to store the timestamp in as well as a 128 Bit ID
87 buffer to store the boot ID of the monotonic timestamp
88 in. The timestamp is in microseconds since boot-up of
89 the specific boot, i.e. CLOCK_MONOTONIC. Since the
90 monotonic clock begins new with every reboot it only
91 defines a well-defined point in time when used
92 together with an identifier identifying the boot, see
93 <citerefentry><refentrytitle>sd_id128_get_boot</refentrytitle><manvolnum>3</manvolnum></citerefentry>
94 for more information. If the boot ID parameter is
95 passed NULL the function will fail if the monotonic
96 timestamp of the current entry is not of the current
97 system boot.</para>
98
99 <para>Note that these functions will not work before
100 <citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry>
101 (or related call) has been called at least
102 once, in order to position the read pointer at a valid entry.</para>
103 </refsect1>
104
105 <refsect1>
106 <title>Return Value</title>
107
108 <para><function>sd_journal_get_realtime_usec()</function>
109 and
110 <function>sd_journal_get_monotonic_usec()</function>
111 returns 0 on success or a negative errno-style error
112 code. If the boot ID parameter was passed NULL and the
113 monotonic timestamp of the current journal entry is
114 not of the current system boot, -ESTALE is returned by <function>sd_journal_get_monotonic_usec()</function>.</para>
115 </refsect1>
116
117 <refsect1>
118 <title>Notes</title>
119
120 <para>The
121 <function>sd_journal_get_realtime_usec()</function>
122 and
123 <function>sd_journal_get_monotonic_usec()</function>
124 interfaces are available as shared library, which can
125 be compiled and linked to with the
126 <literal>libsystemd-journal</literal>
127 <citerefentry><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
128 file.</para>
129 </refsect1>
130
131 <refsect1>
132 <title>See Also</title>
133
134 <para>
135 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
136 <citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
137 <citerefentry><refentrytitle>sd_journal_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
138 <citerefentry><refentrytitle>sd_journal_next</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
139 <citerefentry><refentrytitle>sd_journal_get_data</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
140 <citerefentry><refentrytitle>sd_id128_get_boot</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
141 <citerefentry><refentrytitle>clock_gettime</refentrytitle><manvolnum>2</manvolnum></citerefentry>,
142 <citerefentry><refentrytitle>sd_journal_get_cutoff_realtime_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>
143 </para>
144 </refsect1>
145
146 </refentry>