Debian Codegraph @

upstream/debian-unstable/man3/sd_bus_message_get_monotonic_usec.3

raw
1 '\" t
2 .TH "SD_BUS_MESSAGE_GET_MONOTONIC_USEC" "3" "" "systemd 261~rc3" "sd_bus_message_get_monotonic_usec"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 sd_bus_message_get_monotonic_usec, sd_bus_message_get_realtime_usec, sd_bus_message_get_seqnum \- Retrieve the sender timestamps and sequence number of a message
24 .SH "SYNOPSIS"
25 .sp
26 .ft B
27 .nf
28 #include <systemd/sd\-bus\&.h>
29 .fi
30 .ft
31 .HP \w'int\ sd_bus_message_get_monotonic_usec('u
32 .BI "int sd_bus_message_get_monotonic_usec(sd_bus_message\ *" "message" ", uint64_t\ *" "usec" ");"
33 .HP \w'int\ sd_bus_message_get_realtime_usec('u
34 .BI "int sd_bus_message_get_realtime_usec(sd_bus_message\ *" "message" ", uint64_t\ *" "usec" ");"
35 .HP \w'int\ sd_bus_message_get_seqnum('u
36 .BI "int sd_bus_message_get_seqnum(sd_bus_message\ *" "message" ", uint64_t\ *" "seqnum" ");"
37 .SH "DESCRIPTION"
38 .PP
39 \fBsd_bus_message_get_monotonic_usec()\fR
40 returns the monotonic timestamp of the time the message was sent\&. This value is in microseconds since the
41 \fBCLOCK_MONOTONIC\fR
42 epoch, see
43 \fBclock_gettime\fR(2)
44 for details\&.
45 .PP
46 Similarly,
47 \fBsd_bus_message_get_realtime_usec()\fR
48 returns the realtime (wallclock) timestamp of the time the message was sent\&. This value is in microseconds since Jan 1st, 1970, i\&.e\&. in the
49 \fBCLOCK_REALTIME\fR
50 clock\&.
51 .PP
52 \fBsd_bus_message_get_seqnum()\fR
53 returns the kernel\-assigned sequence number of the message\&. The kernel assigns a global, monotonically increasing sequence number to all messages transmitted on the local system, at the time the message was sent\&. This sequence number is useful for determining message send order, even across different buses of the local system\&. The sequence number combined with the boot ID of the system (as returned by
54 \fBsd_id128_get_boot\fR(3)) is a suitable globally unique identifier for bus messages\&.
55 .PP
56 Note that the sending order and receiving order of messages might differ, in particular for broadcast messages\&. This means that the sequence number and the timestamps of messages a client reads are not necessarily monotonically increasing\&.
57 .PP
58 These timestamps and the sequence number are attached to each message by the kernel and cannot be manipulated by the sender\&.
59 .PP
60 Note that these timestamps are only available on some bus transports, and only after support for them has been negotiated with the
61 \fBsd_bus_negotiate_timestamp\fR(3)
62 call\&.
63 .SH "RETURN VALUE"
64 .PP
65 On success, these calls return 0 or a positive integer\&. On failure, these calls return a negative errno\-style error code\&.
66 .PP
67 On success, the timestamp or sequence number is returned in the specified 64\-bit unsigned integer variable\&.
68 .SS "Errors"
69 .PP
70 Returned errors may indicate the following problems:
71 .PP
72 \fB\-EINVAL\fR
73 .RS 4
74 A specified parameter is invalid\&.
75 .RE
76 .PP
77 \fB\-ENODATA\fR
78 .RS 4
79 No timestamp or sequence number information is attached to the passed message\&. This error is returned if the underlying transport does not support timestamping or assigning of sequence numbers, or if this feature has not been negotiated with
80 \fBsd_bus_negotiate_timestamp\fR(3)\&.
81 .RE
82 .SH "NOTES"
83 .PP
84 Functions described here are available as a shared library, which can be compiled against and linked to with the
85 \fBlibsystemd\fR\ \&\fBpkg-config\fR(1)
86 file\&.
87 .PP
88 The code described here uses
89 \fBgetenv\fR(3), which is declared to be not multi\-thread\-safe\&. This means that the code calling the functions described here must not call
90 \fBsetenv\fR(3)
91 from a parallel thread\&. It is recommended to only do calls to
92 \fBsetenv()\fR
93 from an early phase of the program when no other threads have been started\&.
94 .SH "HISTORY"
95 .PP
96 \fBsd_bus_message_get_monotonic_usec()\fR,
97 \fBsd_bus_message_get_realtime_usec()\fR, and
98 \fBsd_bus_message_get_seqnum()\fR
99 were added in version 209\&.
100 .SH "SEE ALSO"
101 .PP
102 \fBsystemd\fR(1), \fBsd-bus\fR(3), \fBsd_bus_new\fR(3), \fBsd_bus_negotiate_timestamp\fR(3), \fBclock_gettime\fR(2), \fBsd_id128_get_boot\fR(3)