1SD_JOURNAL_GET_REALTIME_USsEdC_(j3o)urnal_get_realtimeS_Du_sJeOcURNAL_GET_REALTIME_USEC(3)
2
3
4
6 sd_journal_get_realtime_usec, sd_journal_get_monotonic_usec - Read
7 timestamps from the current journal entry
8
10 #include <systemd/sd-journal.h>
11
12 int sd_journal_get_realtime_usec(sd_journal *j, uint64_t *usec);
13
14 int sd_journal_get_monotonic_usec(sd_journal *j, uint64_t *usec,
15 sd_id128_t *boot_id);
16
18 sd_journal_get_realtime_usec() gets the realtime (wallclock) timestamp
19 of the current journal entry. It takes two arguments: the journal
20 context object and a pointer to a 64-bit unsigned integer to store the
21 timestamp in. The timestamp is in microseconds since the epoch, i.e.
22 CLOCK_REALTIME.
23
24 sd_journal_get_monotonic_usec() gets the monotonic timestamp of the
25 current journal entry. It takes three arguments: the journal context
26 object, a pointer to a 64-bit unsigned integer to store the timestamp
27 in, as well as a 128-bit ID buffer to store the boot ID of the
28 monotonic timestamp. The timestamp is in microseconds since boot-up of
29 the specific boot, i.e. CLOCK_MONOTONIC. Since the monotonic clock
30 begins new with every reboot, it only defines a well-defined point in
31 time when used together with an identifier identifying the boot. See
32 sd_id128_get_boot(3) for more information. If the boot ID parameter is
33 passed NULL, the function will fail if the monotonic timestamp of the
34 current entry is not of the current system boot.
35
36 Note that these functions will not work before sd_journal_next(3) (or
37 related call) has been called at least once, in order to position the
38 read pointer at a valid entry.
39
41 sd_journal_get_realtime_usec() and sd_journal_get_monotonic_usec()
42 returns 0 on success or a negative errno-style error code. If the boot
43 ID parameter was passed NULL and the monotonic timestamp of the current
44 journal entry is not of the current system boot, -ESTALE is returned by
45 sd_journal_get_monotonic_usec().
46
48 The sd_journal_get_realtime_usec() and sd_journal_get_monotonic_usec()
49 interfaces are available as a shared library, which can be compiled and
50 linked to with the libsystemd pkg-config(1) file.
51
53 systemd(1), sd-journal(3), sd_journal_open(3), sd_journal_next(3),
54 sd_journal_get_data(3), sd_id128_get_boot(3), clock_gettime(2),
55 sd_journal_get_cutoff_realtime_usec(3)
56
57
58
59systemd 219 SD_JOURNAL_GET_REALTIME_USEC(3)