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