| 1 |
'\" t |
| 2 |
.TH "SD_JOURNAL_GET_REALTIME_USEC" "3" "" "systemd 261~rc3" "sd_journal_get_realtime_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_journal_get_realtime_usec, sd_journal_get_monotonic_usec \- Read timestamps from the current journal entry |
| 24 |
.SH "SYNOPSIS" |
| 25 |
.sp |
| 26 |
.ft B |
| 27 |
.nf |
| 28 |
#include <systemd/sd\-journal\&.h> |
| 29 |
.fi |
| 30 |
.ft |
| 31 |
.HP \w'int\ sd_journal_get_realtime_usec('u |
| 32 |
.BI "int sd_journal_get_realtime_usec(sd_journal\ *" "j" ", uint64_t\ *" "usec" ");" |
| 33 |
.HP \w'int\ sd_journal_get_monotonic_usec('u |
| 34 |
.BI "int sd_journal_get_monotonic_usec(sd_journal\ *" "j" ", uint64_t\ *" "usec" ", sd_id128_t\ *" "boot_id" ");" |
| 35 |
.SH "DESCRIPTION" |
| 36 |
.PP |
| 37 |
\fBsd_journal_get_realtime_usec()\fR |
| 38 |
gets the realtime (wallclock) timestamp of the current journal entry\&. It takes two arguments: the journal context object and a pointer to a 64\-bit unsigned integer to store the timestamp in\&. The timestamp is in microseconds since the epoch, i\&.e\&. |
| 39 |
\fBCLOCK_REALTIME\fR\&. |
| 40 |
.PP |
| 41 |
\fBsd_journal_get_monotonic_usec()\fR |
| 42 |
gets the monotonic timestamp of the current journal entry\&. It takes three arguments: the journal context object, a pointer to a 64\-bit unsigned integer to store the timestamp in, as well as a 128\-bit ID buffer to store the boot ID of the monotonic timestamp\&. The timestamp is in microseconds since boot\-up of the specific boot, i\&.e\&. |
| 43 |
\fBCLOCK_MONOTONIC\fR\&. Since the monotonic clock begins new with every reboot, it only defines a well\-defined point in time when used together with an identifier identifying the boot\&. See |
| 44 |
\fBsd_id128_get_boot\fR(3) |
| 45 |
for more information\&. If the boot ID parameter is passed |
| 46 |
\fBNULL\fR, the function will fail if the monotonic timestamp of the current entry is not of the current system boot\&. |
| 47 |
.PP |
| 48 |
Note that these functions will not work before |
| 49 |
\fBsd_journal_next\fR(3) |
| 50 |
(or related call) has been called at least once, in order to position the read pointer at a valid entry\&. |
| 51 |
.SH "RETURN VALUE" |
| 52 |
.PP |
| 53 |
\fBsd_journal_get_realtime_usec()\fR |
| 54 |
and |
| 55 |
\fBsd_journal_get_monotonic_usec()\fR |
| 56 |
returns 0 on success or a negative errno\-style error code\&. If the boot ID parameter was passed |
| 57 |
\fBNULL\fR |
| 58 |
and the monotonic timestamp of the current journal entry is not of the current system boot, |
| 59 |
\fB\-ESTALE\fR |
| 60 |
is returned by |
| 61 |
\fBsd_journal_get_monotonic_usec()\fR\&. |
| 62 |
.SH "NOTES" |
| 63 |
.PP |
| 64 |
All functions listed here are thread\-agnostic and only a single thread may operate on a given object at any given time\&. Different threads may access the same object at different times\&. Multiple independent objects may be used from different threads in parallel\&. |
| 65 |
.PP |
| 66 |
Functions described here are available as a shared library, which can be compiled against and linked to with the |
| 67 |
\fBlibsystemd\fR\ \&\fBpkg-config\fR(1) |
| 68 |
file\&. |
| 69 |
.SH "HISTORY" |
| 70 |
.PP |
| 71 |
\fBsd_journal_get_realtime_usec()\fR |
| 72 |
and |
| 73 |
\fBsd_journal_get_monotonic_usec()\fR |
| 74 |
were added in version 187\&. |
| 75 |
.SH "SEE ALSO" |
| 76 |
.PP |
| 77 |
\fBsystemd\fR(1), \fBsd-journal\fR(3), \fBsd_journal_open\fR(3), \fBsd_journal_next\fR(3), \fBsd_journal_get_data\fR(3), \fBsd_journal_get_seqnum\fR(3), \fBsd_id128_get_boot\fR(3), \fBclock_gettime\fR(2), \fBsd_journal_get_cutoff_realtime_usec\fR(3) |