If we initialize the time stamp too early, the first log entry that we
read will not have zero as its timestamp. Move the initialization
after we know the data is valid to avoid the problem.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
return -1;
}
- if (!start_time)
- start_time = time(NULL);
-
ret = read_log_line(infd, buf, sizeof(buf), &offset);
if (ret < 0)
return ret;
continue;
}
+ if (!start_time)
+ start_time = time(NULL);
+
cur_time = time(NULL);
pr_info("%s\n", buf);