summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-01-11 03:02:10 +0100
committerLennart Poettering <lennart@poettering.net>2012-01-11 03:02:10 +0100
commit3ebcdf8cd97026724fd773648d02bde12d718824 (patch)
tree9512efb79c23ae23132860054a4b1b7c7f0f0010
parentdddd8168d2ed5bcf5c24f46f71d420c462e3beb6 (diff)
journalctl: always show monotonic timestamp even if it's from an old boot
-rw-r--r--src/logs-show.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/logs-show.c b/src/logs-show.c
index 8a35caf23a..cb18da2aa5 100644
--- a/src/logs-show.c
+++ b/src/logs-show.c
@@ -152,22 +152,27 @@ static int output_short(sd_journal *j, unsigned line, bool show_all, bool monoto
if (monotonic_mode) {
uint64_t t;
+ sd_id128_t boot_id;
+
r = -ENOENT;
if (monotonic)
r = safe_atou64(monotonic, &t);
if (r < 0)
- r = sd_journal_get_monotonic_usec(j, &t, NULL);
-
- if (r >= 0) {
- printf("[%5llu.%06llu]",
- (unsigned long long) (t / USEC_PER_SEC),
- (unsigned long long) (t % USEC_PER_SEC));
+ r = sd_journal_get_monotonic_usec(j, &t, &boot_id);
- n += 1 + 5 + 1 + 6 + 1;
+ if (r < 0) {
+ log_error("Failed to get monotonic: %s", strerror(-r));
+ goto finish;
}
+ printf("[%5llu.%06llu]",
+ (unsigned long long) (t / USEC_PER_SEC),
+ (unsigned long long) (t % USEC_PER_SEC));
+
+ n += 1 + 5 + 1 + 6 + 1;
+
} else {
char buf[64];
uint64_t x;