We always read system uptime before log start time. So the uptime
should be always smaller number, except it includes system suspend
time. It seems better to ask for --rel and exit() than try to be
smart and try to recovery from this situation or generate huge
messy graphs.
---
 src/bootchart/bootchart.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/bootchart/bootchart.c b/src/bootchart/bootchart.c
index 909ef46..22c66ba 100644
--- a/src/bootchart/bootchart.c
+++ b/src/bootchart/bootchart.c
@@ -350,6 +350,14 @@ int main(int argc, char *argv[]) {
 
         log_uptime();
 
+        if (graph_start < 0.0) {
+                fprintf(stderr,
+                        "Failed to setup graph start time.\n\nThe system 
uptime "
+                        "probably includes time that the system was suspended. 
"
+                        "Use --rel to bypass this issue.\n");
+                exit (EXIT_FAILURE);
+        }
+
         has_procfs = access("/proc/vmstat", F_OK) == 0;
 
         LIST_HEAD_INIT(head);
-- 
1.9.3

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to