openpower-pels: time: use gmtime for all operations
The test cases in `bcd_time_test.cpp` could fail if the executing
host were not in UTC. By default the BMC uses UTC but the development
systems are often in a user's local time zone. Switch all time
operations to work off UTC by using gmtime/timegm instead of
localtime/mktime.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I6230fd014f44123fe917a8e2b39e3b903d3a05e8
diff --git a/extensions/openpower-pels/journal.cpp b/extensions/openpower-pels/journal.cpp
index 8b7f1f7..c9789fb 100644
--- a/extensions/openpower-pels/journal.cpp
+++ b/extensions/openpower-pels/journal.cpp
@@ -177,7 +177,7 @@
time_t secs = usec / 1000000;
// Convert seconds to tm struct required by strftime()
- struct tm* timeStruct = localtime(&secs);
+ struct tm* timeStruct = gmtime(&secs);
if (timeStruct == nullptr)
{
throw std::runtime_error{