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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-07-04 19:12:03 +02:00
parent 1f65fd4926
commit 3454129571
1 changed files with 5 additions and 3 deletions

View File

@ -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);