diff options
author | Nan Zhou <nanzhoumails@gmail.com> | 2021-12-15 00:30:37 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2021-12-15 22:11:16 +0300 |
commit | 5ae4b692fcee7d27c1e1a5a7c6efbd375a76dacc (patch) | |
tree | d1b241e8d018352a1bac98bcfb54eb49881361fc | |
parent | 145bb764f4132d01e96be5b19510bef63ab63312 (diff) | |
download | bmcweb-5ae4b692fcee7d27c1e1a5a7c6efbd375a76dacc.tar.xz |
Change DateOffset from Z to +00:00
I missed that getDateTimeOffsetNow is extracting the last 5 chars
for DateTimeOffset. So this patch changes the offset to the original
"+00:00" one.
Tested:
1. unit tests
2. Redfish Validator Tests: no errors found on DateTime or
DateTimeLocalOffset.
```
DateTime 1970-01-01T00:13:27+00:00 date Yes PASS
DateTimeLocalOffset +00:00 string Yes PASS
```
All other errors are not related.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I24977c476f18c88515d759e278ec56e5cbb73b3a
-rw-r--r-- | http/ut/utility_test.cpp | 10 | ||||
-rw-r--r-- | http/utility.hpp | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/http/ut/utility_test.cpp b/http/ut/utility_test.cpp index fc8b90e43b..cb914d5cf0 100644 --- a/http/ut/utility_test.cpp +++ b/http/ut/utility_test.cpp @@ -61,17 +61,17 @@ TEST(Utility, GetDateTime) { // some time before the epoch EXPECT_EQ(crow::utility::getDateTimeStdtime(std::time_t{-1234567}), - "1969-12-17T17:03:53Z"); + "1969-12-17T17:03:53+00:00"); // epoch EXPECT_EQ(crow::utility::getDateTimeStdtime(std::time_t{0}), - "1970-01-01T00:00:00Z"); + "1970-01-01T00:00:00+00:00"); // some time in the past after the epoch EXPECT_EQ(crow::utility::getDateTimeUint(uint64_t{1638312095}), - "2021-11-30T22:41:35Z"); + "2021-11-30T22:41:35+00:00"); // some time in the future, beyond 2038 EXPECT_EQ(crow::utility::getDateTimeUint(uint64_t{41638312095}), - "3289-06-18T21:48:15Z"); + "3289-06-18T21:48:15+00:00"); // the maximum time we support EXPECT_EQ(crow::utility::getDateTimeUint(uint64_t{253402300799}), - "9999-12-31T23:59:59Z"); + "9999-12-31T23:59:59+00:00"); } diff --git a/http/utility.hpp b/http/utility.hpp index d1410566c3..033755e273 100644 --- a/http/utility.hpp +++ b/http/utility.hpp @@ -584,7 +584,7 @@ inline std::string getDateTime(boost::posix_time::seconds secondsSinceEpoch) boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); boost::posix_time::ptime time = epoch + secondsSinceEpoch; // append zero offset to the end according to the Redfish spec for Date-Time - return boost::posix_time::to_iso_extended_string(time) + 'Z'; + return boost::posix_time::to_iso_extended_string(time) + "+00:00"; } inline std::string getDateTimeUint(uint64_t secondsSinceEpoch) |