]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/sd_event_now.xml
seccomp: drop execve() from @process list
[thirdparty/systemd.git] / man / sd_event_now.xml
CommitLineData
dc83f27a
LP
1<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
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 2015 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_event_now" xmlns:xi="http://www.w3.org/2001/XInclude">
25
26 <refentryinfo>
27 <title>sd_event_now</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_event_now</refentrytitle>
42 <manvolnum>3</manvolnum>
43 </refmeta>
44
45 <refnamediv>
46 <refname>sd_event_now</refname>
47
48 <refpurpose>Retrieve current event loop iteration timestamp</refpurpose>
49 </refnamediv>
50
51 <refsynopsisdiv>
52 <funcsynopsis>
53 <funcsynopsisinfo>#include &lt;systemd/sd-event.h&gt;</funcsynopsisinfo>
54
55 <funcprototype>
56 <funcdef>int <function>sd_event_now</function></funcdef>
57 <paramdef>sd_event *<parameter>event</parameter></paramdef>
58 <paramdef>clockid_t <parameter>clock</parameter></paramdef>
59 <paramdef>uint64_t *<parameter>usec</parameter></paramdef>
60 </funcprototype>
61
62 </funcsynopsis>
63 </refsynopsisdiv>
64
65 <refsect1>
66 <title>Description</title>
67
f23e83b1
ZJS
68 <para><function>sd_event_now()</function> returns the time when
69 the most recent event loop iteration began. A timestamp
70 is taken right after returning from the event sleep, and before
dc83f27a 71 dispatching any event sources. The <parameter>event</parameter>
f23e83b1 72 parameter specifies the event loop object to retrieve the timestamp
dc83f27a
LP
73 from. The <parameter>clock</parameter> parameter specifies the clock to
74 retrieve the timestamp for, and is one of
f23e83b1 75 <constant>CLOCK_REALTIME</constant> (or equivalently
dc83f27a 76 <constant>CLOCK_REALTIME_ALARM</constant>),
f23e83b1
ZJS
77 <constant>CLOCK_MONOTONIC</constant>, or
78 <constant>CLOCK_BOOTTIME</constant> (or equivalently
79 <constant>CLOCK_BOOTTIME_ALARM</constant>), see
80 <citerefentry project='man-pages'><refentrytitle>clock_gettime</refentrytitle><manvolnum>2</manvolnum></citerefentry>
dc83f27a
LP
81 for more information on the various clocks. The retrieved
82 timestamp is stored in the <parameter>usec</parameter> parameter,
83 in µs since the clock's epoch. If this function is invoked before
f23e83b1 84 the first event loop iteration, the current time is returned, as
dc83f27a
LP
85 reported by <function>clock_gettime()</function>. To distinguish
86 this case from a regular invocation the return value will be
f23e83b1
ZJS
87 positive, and zero when the returned timestamp refers to an actual
88 event loop iteration.</para>
dc83f27a
LP
89 </refsect1>
90
91 <refsect1>
92 <title>Return Value</title>
93
94 <para>If the first event loop iteration has not run yet
f23e83b1
ZJS
95 <function>sd_event_now()</function> writes current time to
96 <parameter>usec</parameter> and returns a positive return value.
97 Otherwise, it will write the requested timestamp to <parameter>usec</parameter>
98 and return 0. On failure, the call returns a negative errno-style
dc83f27a
LP
99 error code.</para>
100 </refsect1>
101
102 <refsect1>
103 <title>Errors</title>
104
f23e83b1 105 <para>Returned values may indicate the following problems:</para>
dc83f27a
LP
106
107 <variablelist>
108 <varlistentry>
109 <term><constant>-EINVAL</constant></term>
110
111 <listitem><para>An invalid parameter was
112 passed.</para></listitem>
113
114 </varlistentry>
115
2c86ba5a
ZJS
116 <varlistentry>
117 <term><constant>-EOPNOTSUPP</constant></term>
118
119 <listitem><para>Unsupported clock type.
120 </para></listitem>
121 </varlistentry>
122
dc83f27a
LP
123 <varlistentry>
124 <term><constant>-ECHILD</constant></term>
125
126 <listitem><para>The event loop object was created in a
127 different process.</para></listitem>
128 </varlistentry>
dc83f27a
LP
129 </variablelist>
130 </refsect1>
131
132 <xi:include href="libsystemd-pkgconfig.xml" />
133
134 <refsect1>
135 <title>See Also</title>
136
137 <para>
138 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
139 <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
140 <citerefentry><refentrytitle>sd_event_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
141 <citerefentry><refentrytitle>sd_event_add_time</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
142 <citerefentry project='man-pages'><refentrytitle>clock_gettime</refentrytitle><manvolnum>2</manvolnum></citerefentry>
143 </para>
144 </refsect1>
145
146</refentry>