]>
Commit | Line | Data |
---|---|---|
663996b3 MS |
1 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>sd_journal_get_realtime_usec</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style> |
2 | a.headerlink { | |
3 | color: #c60f0f; | |
4 | font-size: 0.8em; | |
5 | padding: 0 4px 0 4px; | |
6 | text-decoration: none; | |
7 | visibility: hidden; | |
8 | } | |
9 | ||
10 | a.headerlink:hover { | |
11 | background-color: #c60f0f; | |
12 | color: white; | |
13 | } | |
14 | ||
15 | h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink { | |
16 | visibility: visible; | |
17 | } | |
18 | </style><a href="index.html">Index </a>· | |
19 | <a href="systemd.directives.html">Directives </a>· | |
20 | <a href="../python-systemd/index.html">Python </a>· | |
21 | <a href="../libudev/index.html">libudev </a>· | |
e735f4d4 MP |
22 | <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 219</span><hr><div class="refentry"><a name="sd_journal_get_realtime_usec"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>sd_journal_get_realtime_usec, sd_journal_get_monotonic_usec — Read timestamps from the current journal entry</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <systemd/sd-journal.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_journal_get_realtime_usec</b>(</code></td><td>sd_journal *<var class="pdparam">j</var>, </td></tr><tr><td> </td><td>uint64_t *<var class="pdparam">usec</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_journal_get_monotonic_usec</b>(</code></td><td>sd_journal *<var class="pdparam">j</var>, </td></tr><tr><td> </td><td>uint64_t *<var class="pdparam">usec</var>, </td></tr><tr><td> </td><td>sd_id128_t *<var class="pdparam">boot_id</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idm140190505320304"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p><code class="function">sd_journal_get_realtime_usec()</code> gets the |
23 | realtime (wallclock) timestamp of the current journal entry. It | |
24 | takes two arguments: the journal context object and a pointer to a | |
25 | 64-bit unsigned integer to store the timestamp in. The timestamp | |
26 | is in microseconds since the epoch, i.e. | |
27 | <code class="constant">CLOCK_REALTIME</code>.</p><p><code class="function">sd_journal_get_monotonic_usec()</code> gets | |
28 | the monotonic timestamp of the current journal entry. It takes | |
29 | three arguments: the journal context object, a pointer to a 64-bit | |
30 | unsigned integer to store the timestamp in, as well as a 128-bit | |
31 | ID buffer to store the boot ID of the monotonic timestamp. The | |
32 | timestamp is in microseconds since boot-up of the specific boot, | |
33 | i.e. <code class="constant">CLOCK_MONOTONIC</code>. Since the monotonic | |
34 | clock begins new with every reboot, it only defines a well-defined | |
35 | point in time when used together with an identifier identifying | |
36 | the boot. See | |
37 | <a href="sd_id128_get_boot.html"><span class="citerefentry"><span class="refentrytitle">sd_id128_get_boot</span>(3)</span></a> | |
38 | for more information. If the boot ID parameter is passed | |
39 | <code class="constant">NULL</code>, the function will fail if the monotonic | |
40 | timestamp of the current entry is not of the current system | |
41 | boot.</p><p>Note that these functions will not work before | |
42 | <a href="sd_journal_next.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_next</span>(3)</span></a> | |
43 | (or related call) has been called at least | |
44 | once, in order to position the read pointer at a valid entry.</p></div><div class="refsect1"><a name="idm140190505313248"></a><h2 id="Return Value">Return Value<a class="headerlink" title="Permalink to this headline" href="#Return%20Value">¶</a></h2><p><code class="function">sd_journal_get_realtime_usec()</code> and | |
45 | <code class="function">sd_journal_get_monotonic_usec()</code> returns 0 on | |
46 | success or a negative errno-style error code. If the boot ID | |
47 | parameter was passed <code class="constant">NULL</code> and the monotonic | |
48 | timestamp of the current journal entry is not of the current | |
49 | system boot, <code class="constant">-ESTALE</code> is returned by | |
50 | <code class="function">sd_journal_get_monotonic_usec()</code>.</p></div><div class="refsect1"><a name="idm140190509263536"></a><h2 id="Notes">Notes<a class="headerlink" title="Permalink to this headline" href="#Notes">¶</a></h2><p>The <code class="function">sd_journal_get_realtime_usec()</code> and | |
51 | <code class="function">sd_journal_get_monotonic_usec()</code> interfaces | |
52 | are available as a shared library, which can be compiled and | |
53 | linked to with the | |
54 | <code class="constant">libsystemd</code> <a href="http://linux.die.net/man/1/pkg-config"><span class="citerefentry"><span class="refentrytitle">pkg-config</span>(1)</span></a> | |
55 | file.</p></div><div class="refsect1"><a name="idm140190509259152"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p> | |
56 | <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>, | |
57 | <a href="sd-journal.html"><span class="citerefentry"><span class="refentrytitle">sd-journal</span>(3)</span></a>, | |
58 | <a href="sd_journal_open.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_open</span>(3)</span></a>, | |
59 | <a href="sd_journal_next.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_next</span>(3)</span></a>, | |
60 | <a href="sd_journal_get_data.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_get_data</span>(3)</span></a>, | |
61 | <a href="sd_id128_get_boot.html"><span class="citerefentry"><span class="refentrytitle">sd_id128_get_boot</span>(3)</span></a>, | |
62 | <a href="http://man7.org/linux/man-pages/man2/clock_gettime.2.html"><span class="citerefentry"><span class="refentrytitle">clock_gettime</span>(2)</span></a>, | |
63 | <a href="sd_journal_get_cutoff_realtime_usec.html"><span class="citerefentry"><span class="refentrytitle">sd_journal_get_cutoff_realtime_usec</span>(3)</span></a> | |
64 | </p></div></div></body></html> |