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