analyze: fix condition for pretty printing kernel time
authorKirill Marinushkin <kmarinushkin@de.adit-jv.com>
Mon, 6 Aug 2018 09:27:33 +0000 (18:27 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 6 Aug 2018 14:13:53 +0000 (23:13 +0900)
commit02be0ccad2fbf36a585b0374bf220e5477983cf2
treec8687ec2bc41d25b96dcd095154066aa2bb00d3c
parenteddb5037f136f0699bcb0b3968603838c4615f95
analyze: fix condition for pretty printing kernel time

On target boards without RTC, `t->kernel_time` is 0 or 1 usec.
`systemd-analyze` reads this value over D-Bus from
`org.freedesktop.systemd1.Manager`, property `KernelTimestamp`.

The issue is: if `t->kernel_time` is 0, `systemd-analyze` does not print
the kernel time:

~~~~
$ systemd-analyze
Startup finished in 1.860s (userspace) = 5.957s
~~~~

This commit fixes the misbehaviour:

~~~~
$ systemd-analyze
Startup finished in 3.866s (kernel) + 2.015s (userspace) = 5.881s
~~~~

Fixes #7721.

v2: fixes one more condition (by Yu Watanabe <watanabe.yu+github@gmail.com>)
v3: fixes one more condition (by Kirill Marinushkin <kmarinushkin@de.adit-jv.com>)
src/analyze/analyze.c