commit | b24113032453cbb7f3eda20869428b6021e38a7e | [log] [tgz] |
---|---|---|
author | Willy Tu <wltu@google.com> | Thu Nov 03 08:49:51 2022 +0000 |
committer | Willy Tu <wltu@google.com> | Mon Aug 28 14:11:49 2023 +0000 |
tree | 048b24812d98e53b881525eb75a46a0014d7e386 | |
parent | 2f0a6d034c1fe9c6ecd844e8cd42449073c91a98 [diff] |
ipmid: fru-reader: Use timegm instead of mktime timegm is the inverse of gmtime. Currently, we are missing UTC time with localtime when converting between timestamp and time string. This is not an issue when the localtime is the same as UTC. This issue is detected when we change the timezone to PST/PDT with https://gerrit.openbmc.org/c/openbmc/openbmc/+/58293 and the FRU EEPROM time does not match the expected Mfg Date anymore. Required: https://gerrit.openbmc.org/c/openbmc/ipmi-fru-parser/+/58446 Tested: Fru EEPROM Mfg Time now is in the same (after timezone conversion) between the raw data and FRU output. Change-Id: I4c636b0044e1b2a6dd2c078b62f65665d4b1108c Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/ipmi_fru_info_area.cpp b/ipmi_fru_info_area.cpp index a970467..ec3f80d 100644 --- a/ipmi_fru_info_area.cpp +++ b/ipmi_fru_info_area.cpp
@@ -216,7 +216,7 @@ } } - return std::mktime(&time); + return timegm(&time); } /**