From: Zbigniew Jędrzejewski-Szmek Date: Thu, 4 Jul 2019 17:12:03 +0000 (+0200) Subject: pid1: use monotonic timestamp in dump if realtime is not available X-Git-Tag: v243-rc1~191^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12963%2Fhead;p=thirdparty%2Fsystemd.git pid1: use monotonic timestamp in dump if realtime is not available $ systemd-analyze dump | head -3 Timestamp firmware: (null) Timestamp loader: (null) Timestamp kernel: Mon 2019-07-01 17:21:02 CEST Since this is a debugging interface, it is OK to change the output format. The user can infer what "Timestamp firmware: 123.456ms" means. --- diff --git a/src/core/manager.c b/src/core/manager.c index 3ded0d96a1b..4a2f07368ae 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -2094,13 +2094,15 @@ void manager_dump(Manager *m, FILE *f, const char *prefix) { assert(f); for (q = 0; q < _MANAGER_TIMESTAMP_MAX; q++) { - char buf[FORMAT_TIMESTAMP_MAX]; + const dual_timestamp *t = m->timestamps + q; + char buf[CONST_MAX(FORMAT_TIMESPAN_MAX, FORMAT_TIMESTAMP_MAX)]; - if (dual_timestamp_is_set(m->timestamps + q)) + if (dual_timestamp_is_set(t)) fprintf(f, "%sTimestamp %s: %s\n", strempty(prefix), manager_timestamp_to_string(q), - format_timestamp(buf, sizeof(buf), m->timestamps[q].realtime)); + timestamp_is_set(t->realtime) ? format_timestamp(buf, sizeof buf, t->realtime) : + format_timespan(buf, sizeof buf, t->monotonic, 1)); } manager_dump_units(m, f, prefix);