mirror of
https://github.com/systemd/systemd.git
synced 2024-11-06 16:59:03 +03:00
journalctl: always show monotonic timestamp even if it's from an old boot
This commit is contained in:
parent
dddd8168d2
commit
3ebcdf8cd9
@ -152,21 +152,26 @@ static int output_short(sd_journal *j, unsigned line, bool show_all, bool monoto
|
|||||||
|
|
||||||
if (monotonic_mode) {
|
if (monotonic_mode) {
|
||||||
uint64_t t;
|
uint64_t t;
|
||||||
|
sd_id128_t boot_id;
|
||||||
|
|
||||||
r = -ENOENT;
|
r = -ENOENT;
|
||||||
|
|
||||||
if (monotonic)
|
if (monotonic)
|
||||||
r = safe_atou64(monotonic, &t);
|
r = safe_atou64(monotonic, &t);
|
||||||
|
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
r = sd_journal_get_monotonic_usec(j, &t, NULL);
|
r = sd_journal_get_monotonic_usec(j, &t, &boot_id);
|
||||||
|
|
||||||
|
if (r < 0) {
|
||||||
|
log_error("Failed to get monotonic: %s", strerror(-r));
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
|
|
||||||
if (r >= 0) {
|
|
||||||
printf("[%5llu.%06llu]",
|
printf("[%5llu.%06llu]",
|
||||||
(unsigned long long) (t / USEC_PER_SEC),
|
(unsigned long long) (t / USEC_PER_SEC),
|
||||||
(unsigned long long) (t % USEC_PER_SEC));
|
(unsigned long long) (t % USEC_PER_SEC));
|
||||||
|
|
||||||
n += 1 + 5 + 1 + 6 + 1;
|
n += 1 + 5 + 1 + 6 + 1;
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
char buf[64];
|
char buf[64];
|
||||||
|
Loading…
Reference in New Issue
Block a user