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