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 All functions listed here are thread-agnostic and only a single
49 specific thread may operate on a given object during its entire
50 lifetime. It's safe to allocate multiple independent objects and use
51 each from a specific thread in parallel. However, it's not safe to
52 allocate such an object in one thread, and operate or free it from any
53 other, even if locking is used to ensure these threads don't operate on
54 it at the very same time.
55
56 These APIs are implemented as a shared library, which can be compiled
57 and linked to with the libsystemd pkg-config(1) file.
58
60 systemd(1), sd-journal(3), sd_journal_open(3), sd_journal_next(3),
61 sd_journal_get_data(3), sd_id128_get_boot(3), clock_gettime(2),
62 sd_journal_get_cutoff_realtime_usec(3)
63
64
65
66systemd 253 SD_JOURNAL_GET_REALTIME_USEC(3)