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/test/openpower-pels/bcd_time_test.cpp b/test/openpower-pels/bcd_time_test.cpp
index 1f444b3..f0f3111 100644
--- a/test/openpower-pels/bcd_time_test.cpp
+++ b/test/openpower-pels/bcd_time_test.cpp
@@ -81,7 +81,7 @@
time_tm.tm_sec = 42;
time_tm.tm_isdst = 0;
- auto timepoint = std::chrono::system_clock::from_time_t(mktime(&time_tm));
+ auto timepoint = std::chrono::system_clock::from_time_t(timegm(&time_tm));
auto timeInBCD = getBCDTime(timepoint);
EXPECT_EQ(timeInBCD.yearMSB, 0x20);