]> git.itanic.dy.fi Git - log-plotter/commitdiff
Fill in time stamp even if charger produces zero input
authorTimo Kokkonen <timo.t.kokkonen@iki.fi>
Thu, 10 Oct 2013 18:32:45 +0000 (21:32 +0300)
committerTimo Kokkonen <timo.t.kokkonen@iki.fi>
Thu, 10 Oct 2013 18:32:45 +0000 (21:32 +0300)
Always zero timestamp is invalid. Replace it with a proper one.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
data.c

diff --git a/data.c b/data.c
index 0e334d810554f4b4240283bee2626631fddc99ec..639b6f82b5ececd7627eeebc0fe94c420771b302 100644 (file)
--- a/data.c
+++ b/data.c
@@ -262,11 +262,12 @@ int read_data(int infd, int outfd)
 
                parse_logline(buf, &data);
 
 
                parse_logline(buf, &data);
 
-               dump_data(&data);
-
-               if (isnan(data.timestamp))
+               /* Fill in possibly missing timestamp */
+               if (isnan(data.timestamp) || data.timestamp == 0);
                        data.timestamp = cur_time - start_time;
 
                        data.timestamp = cur_time - start_time;
 
+               dump_data(&data);
+
                if (!outfd)
                        continue;
 
                if (!outfd)
                        continue;