]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
man: document new relative time APIs in sd-event
authorLennart Poettering <lennart@poettering.net>
Tue, 28 Jul 2020 09:18:08 +0000 (11:18 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 28 Jul 2020 09:24:37 +0000 (11:24 +0200)
man/sd_event_add_time.xml

index 8d3511ef638a3052222cd8f526e8ad9193cb3266..1fc24c8ab07994a42f295926049cefcd28638811 100644 (file)
         <paramdef>void *<parameter>userdata</parameter></paramdef>
       </funcprototype>
 
+      <funcprototype>
+        <funcdef>int <function>sd_event_add_time_relative</function></funcdef>
+        <paramdef>sd_event *<parameter>event</parameter></paramdef>
+        <paramdef>sd_event_source **<parameter>source</parameter></paramdef>
+        <paramdef>clockid_t <parameter>clock</parameter></paramdef>
+        <paramdef>uint64_t <parameter>usec</parameter></paramdef>
+        <paramdef>uint64_t <parameter>accuracy</parameter></paramdef>
+        <paramdef>sd_event_time_handler_t <parameter>handler</parameter></paramdef>
+        <paramdef>void *<parameter>userdata</parameter></paramdef>
+      </funcprototype>
+
       <funcprototype>
         <funcdef>int <function>sd_event_source_get_time</function></funcdef>
         <paramdef>sd_event_source *<parameter>source</parameter></paramdef>
         <paramdef>uint64_t <parameter>usec</parameter></paramdef>
       </funcprototype>
 
+      <funcprototype>
+        <funcdef>int <function>sd_event_source_set_time_relative</function></funcdef>
+        <paramdef>sd_event_source *<parameter>source</parameter></paramdef>
+        <paramdef>uint64_t <parameter>usec</parameter></paramdef>
+      </funcprototype>
+
       <funcprototype>
         <funcdef>int <function>sd_event_source_get_time_accuracy</function></funcdef>
         <paramdef>sd_event_source *<parameter>source</parameter></paramdef>
     <function>sd_event_source_set_time()</function>.
     </para>
 
+    <para><function>sd_event_add_time_relative()</function> is like <function>sd_event_add_time()</function>,
+    but takes a relative time specification. It's relative to the current time of the event loop iteration,
+    as returned by
+    <citerefentry><refentrytitle>sd_event_now</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
+
     <para>To destroy an event source object use
     <citerefentry><refentrytitle>sd_event_source_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
     but note that the event source is only removed from the event loop
     events will be regular, while in the latter case the scheduling
     latency will keep accumulating on the timer.</para>
 
-    <para><function>sd_event_source_get_time()</function> retrieves
-    the configured time value of an event source created
-    previously with <function>sd_event_add_time()</function>. It takes
-    the event source object and a pointer to a variable to store the
-    time in, relative to the selected clock's epoch, in µs.</para>
+    <para><function>sd_event_source_get_time()</function> retrieves the configured time value of an event
+    source created previously with <function>sd_event_add_time()</function> or
+    <function>sd_event_add_time_relative()</function>. It takes the event source object and a pointer to a
+    variable to store the time in, relative to the selected clock's epoch, in µs. The returned value is
+    relative to the epoch, even if the event source was created with a relative time via
+    <function>sd_event_add_time_relative()</function>.</para>
+
+    <para><function>sd_event_source_set_time()</function> changes the time of an event source created
+    previously with <function>sd_event_add_time()</function> or
+    <function>sd_event_add_time_relative()</function>. It takes the event source object and a time relative
+    to the selected clock's epoch, in µs.</para>
 
-    <para><function>sd_event_source_set_time()</function> changes the
-    time of an event source created previously with
-    <function>sd_event_add_time()</function>. It takes the event
-    source object and a time relative to the selected clock's epoch,
-    in µs.</para>
+    <para><function>sd_event_source_set_time_relative()</function> is similar to
+    <function>sd_event_source_set_time()</function>, but takes a time relative to the current time of the
+    event loop iteration, as returned by <function>sd_event_now()</function>.</para>
 
     <para><function>sd_event_source_get_time_accuracy()</function>
     retrieves the configured accuracy value of an event source
 
           <listitem><para>The passed event source is not a timer event source.</para></listitem>
         </varlistentry>
+
+        <varlistentry>
+          <term><constant>-EOVERFLOW</constant></term>
+
+          <listitem><para>The passed relative time is outside of the allowed range for time values (i.e. the
+          specified value added to the current time is outside the 64 bit unsigned integer range).</para></listitem>
+        </varlistentry>
       </variablelist>
     </refsect2>
   </refsect1>