summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Quesada <ricardoq@google.com>2021-09-22 20:08:35 -0700
committerPatrick Georgi <pgeorgi@google.com>2021-09-24 18:08:43 +0000
commit1427f12adf8092b8ab7c9963f16f3e4683c81498 (patch)
tree9dc37708f2e3dc3bc0fb136ba3309423b870a515
parent325f431a9176cd9726474a08d9942819f4643ed9 (diff)
elogtool: Fix off-by-one error in month in timestamp
elogtool was setting the timestamp with the wrong value in the month. This CL fixes that by incrementing the month by one. This is needed since gmtime() returns the month value starting at 0. TEST=pytest elogtool_test.py (see next CL in relation chain) Change-Id: I00f89ed99b049caafba2e47feae3c068245f9021 Signed-off-by: Ricardo Quesada <ricardoq@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/57868 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
-rw-r--r--util/cbfstool/eventlog.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/cbfstool/eventlog.c b/util/cbfstool/eventlog.c
index 8b03686ecd..3ea352e6eb 100644
--- a/util/cbfstool/eventlog.c
+++ b/util/cbfstool/eventlog.c
@@ -657,8 +657,9 @@ int eventlog_init_event(const struct buffer *buf, uint8_t type,
event->type = type;
gmtime_r(&secs, &tm);
+ /* Month should be +1, since gmtime uses 0 as first month */
elog_fill_timestamp(event, tm.tm_sec, tm.tm_min, tm.tm_hour,
- tm.tm_mday, tm.tm_mon, tm.tm_year);
+ tm.tm_mday, tm.tm_mon + 1, tm.tm_year);
if (data && data_size) {
uint32_t *ptr = (uint32_t *)&event[1];