| |
| #include "libpldmresponder/bios.hpp" |
| |
| #include <string.h> |
| |
| #include <array> |
| #include <ctime> |
| |
| #include "libpldm/base.h" |
| #include "libpldm/bios.h" |
| |
| #include <gtest/gtest.h> |
| |
| using namespace pldm::responder; |
| using namespace pldm::responder::utils; |
| |
| TEST(epochToBCDTime, testTime) |
| { |
| struct tm time |
| { |
| }; |
| time.tm_year = 119; |
| time.tm_mon = 3; |
| time.tm_mday = 13; |
| time.tm_hour = 5; |
| time.tm_min = 18; |
| time.tm_sec = 13; |
| time.tm_isdst = -1; |
| |
| time_t epochTime = mktime(&time); |
| uint8_t seconds = 0; |
| uint8_t minutes = 0; |
| uint8_t hours = 0; |
| uint8_t day = 0; |
| uint8_t month = 0; |
| uint16_t year = 0; |
| |
| epochToBCDTime(epochTime, seconds, minutes, hours, day, month, year); |
| |
| ASSERT_EQ(0x13, seconds); |
| ASSERT_EQ(0x18, minutes); |
| ASSERT_EQ(0x5, hours); |
| ASSERT_EQ(0x13, day); |
| ASSERT_EQ(0x4, month); |
| ASSERT_EQ(0x2019, year); |
| } |