]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/sd_bus_message_get_monotonic_usec.xml
doc: choose different words to improve clarity
[thirdparty/systemd.git] / man / sd_bus_message_get_monotonic_usec.xml
CommitLineData
37369553
LP
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 2013 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_bus_message_get_monotonic_usec">
25
26 <refentryinfo>
27 <title>sd_bus_message_get_monotonic_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_bus_message_get_monotonic_usec</refentrytitle>
42 <manvolnum>3</manvolnum>
43 </refmeta>
44
45 <refnamediv>
46 <refname>sd_bus_message_get_monotonic_usec</refname>
47 <refname>sd_bus_message_get_realtime_usec</refname>
48 <refname>sd_bus_message_get_seqnum</refname>
49 <refpurpose>Retrieve the sender timestamps and sequence number of a message</refpurpose>
50 </refnamediv>
51
52 <refsynopsisdiv>
53 <funcsynopsis>
54 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
55
56 <funcprototype>
57 <funcdef>int <function>sd_bus_message_get_monotonic_usec</function></funcdef>
58 <paramdef>sd_bus_message* <parameter>message</parameter></paramdef>
59 <paramdef>uint64_t* <parameter>usec</parameter></paramdef>
60 </funcprototype>
61
62 <funcprototype>
63 <funcdef>int <function>sd_bus_message_get_realtime_usec</function></funcdef>
64 <paramdef>sd_bus_message* <parameter>message</parameter></paramdef>
65 <paramdef>uint64_t* <parameter>usec</parameter></paramdef>
66 </funcprototype>
67
68 <funcprototype>
69 <funcdef>int <function>sd_bus_message_get_seqnum</function></funcdef>
70 <paramdef>sd_bus_message* <parameter>message</parameter></paramdef>
71 <paramdef>uint64_t* <parameter>seqnum</parameter></paramdef>
72 </funcprototype>
73 </funcsynopsis>
74 </refsynopsisdiv>
75
76 <refsect1>
77 <title>Description</title>
78
79 <para><function>sd_bus_message_get_monotonic_usec()</function>
80 returns the monotonic timestamp of the time the
81 message was sent. This value is in microseconds since
82 the <literal>CLOCK_MONOTONIC</literal> epoch, see
83 <citerefentry><refentrytitle>clock_gettime</refentrytitle><manvolnum>2</manvolnum></citerefentry>
84 for details.</para>
85
86 <para>Similar,
87 <function>sd_bus_message_get_realtime_usec()</function>
88 returns the realtime (wallclock) timestamp of the time
89 the message was sent. This value is in microseconds
90 since Jan 1st, 1970, i.e. in the
91 <literal>CLOCK_REALTIME</literal> clock.</para>
92
93 <para><function>sd_bus_message_get_seqnum()</function>
94 returns the kernel-assigned sequence number of the
95 message. The kernel assigns a global monotonically increasing
96 sequence number to all messages sent on the local
97 system. This sequence number is useful for determining
98 message send order, even across different busses of
99 the local system. The sequence number combined with
100 the boot ID of the system (as returned by
101 <citerefentry><refentrytitle>sd_id128_get_boot</refentrytitle><manvolnum>3</manvolnum></citerefentry>)
102 is a suitable globally unique identifier for bus
103 messages.</para>
104
105 <para>These timestamps and the sequence number are
106 attached to each message by the kernel and cannot be
dc968941 107 manipulated by the sender.</para>
37369553
LP
108
109 <para>Note that these timestamps are only available on
110 some bus transports, and only after support for them
111 has been negotiated with the
112 <citerefentry><refentrytitle>sd_bus_negotiate_timestamp</refentrytitle><manvolnum>3</manvolnum></citerefentry>
113 call.</para>
114 </refsect1>
115
116 <refsect1>
117 <title>Return Value</title>
118
119 <para>On success, these calls return 0 or a positive
120 integer. On failure, these calls return a negative
121 errno-style error code.</para>
122
123 <para>On success, the timestamp or sequence number is
124 returned in the specified 64-bit unsigned integer
125 variable.</para>
126 </refsect1>
127
128 <refsect1>
129 <title>Errors</title>
130
131 <para>Returned errors may indicate the following problems:</para>
132
133 <variablelist>
134 <varlistentry>
135 <term><varname>-EINVAL</varname></term>
136
137 <listitem><para>A specified parameter
138 is invalid.</para></listitem>
139 </varlistentry>
140
141 <varlistentry>
142 <term><varname>-ENODATA</varname></term>
143
144 <listitem><para>No timestamp or
145 sequence number information is
146 attached to the passed message. This
147 error is returned if the underlying
148 transport does not support
149 timestamping or assigning of sequence
150 numbers, or if this feature has not
151 been negotiated with
152 <citerefentry><refentrytitle>sd_bus_negotiate_timestamp</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para></listitem>
153 </varlistentry>
154 </variablelist>
155 </refsect1>
156
157 <refsect1>
158 <title>Notes</title>
159
160 <para>The
161 <function>sd_bus_message_get_monotonic_usec()</function>,
162 <function>sd_bus_message_get_realtime_usec()</function>,
163 and <function>sd_bus_message_get_seqnum()</function>
164 interfaces are available as a shared library, which
165 can be compiled and linked to with the
166 <constant>libsystemd</constant> <citerefentry><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
167 file.</para>
168 </refsect1>
169
170 <refsect1>
171 <title>See Also</title>
172
173 <para>
174 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
175 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
176 <citerefentry><refentrytitle>sd_bus_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
177 <citerefentry><refentrytitle>sd_bus_negotiate_timestamp</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
178 <citerefentry><refentrytitle>clock_gettime</refentrytitle><manvolnum>2</manvolnum></citerefentry>,
179 <citerefentry><refentrytitle>sd_id128_get_boot</refentrytitle><manvolnum>3</manvolnum></citerefentry>
180 </para>
181 </refsect1>
182
183</refentry>