This commit is contained in:
Scott E. Graves 2024-09-26 15:41:59 -05:00
parent ef50acc867
commit afcba6b086
2 changed files with 7 additions and 4 deletions

View File

@ -63,9 +63,12 @@ auto s3_provider::convert_api_date(std::string_view date) -> std::uint64_t {
// 2009-10-12T17:50:30.000Z
auto date_parts = utils::string::split(date, '.', true);
auto date_time = date_parts.at(0U);
auto nanos = utils::string::to_uint64(
utils::string::split(date_parts.at(1U), 'Z', true).at(0U)) *
1000000UL;
auto nanos =
(date_parts.size() == 1U)
? 0U
: utils::string::to_uint64(
utils::string::split(date_parts.at(1U), 'Z', true).at(0U)) *
1000000UL;
struct tm tm1 {};
#if defined(_WIN32)

View File

@ -38,7 +38,7 @@ TEST(utils, convert_api_date) {
EXPECT_EQ(2009, st.wYear);
EXPECT_EQ(10, st.wMonth);
EXPECT_EQ(12, lt.wDay);
EXPECT_EQ(12, st.wDay);
EXPECT_EQ(17, st.wHour);
EXPECT_EQ(50, st.wMinute);