diff --git a/repertory/librepertory/src/providers/s3/s3_provider.cpp b/repertory/librepertory/src/providers/s3/s3_provider.cpp index cc96408a..cf45cc1d 100644 --- a/repertory/librepertory/src/providers/s3/s3_provider.cpp +++ b/repertory/librepertory/src/providers/s3/s3_provider.cpp @@ -64,11 +64,12 @@ auto s3_provider::convert_api_date(std::string_view date) -> std::uint64_t { 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)); + utils::string::split(date_parts.at(1U), 'Z', true).at(0U)) * + 1000000UL; struct tm tm1 {}; #if defined(_WIN32) - utils::time::strptime(date_time.c_str(), "%Y-%m-%dT%T", &tm1); + utils::time::strptime(date_time.c_str(), "%Y-%m-%dT%H:%M:%S", &tm1); return nanos + utils::time::windows_time_t_to_unix_time(mktime(&tm1)); #else // !defined(_WIN32) strptime(date_time.c_str(), "%Y-%m-%dT%T", &tm1); diff --git a/repertory/repertory_test/src/utils_test.cpp b/repertory/repertory_test/src/utils_test.cpp index 4277f7c5..acb2849c 100644 --- a/repertory/repertory_test/src/utils_test.cpp +++ b/repertory/repertory_test/src/utils_test.cpp @@ -28,8 +28,9 @@ namespace repertory { #if defined(_WIN32) TEST(utils, convert_api_date) { LARGE_INTEGER li{}; - li.QuadPart = static_cast(utils::time::unix_time_to_windows_time( - s3_provider::convert_api_date("2009-10-12T17:50:30.000Z"))); + li.QuadPart = + static_cast(utils::time::unix_time_to_windows_time( + s3_provider::convert_api_date("2009-10-12T17:50:30.111Z"))); SYSTEMTIME st{}; FileTimeToSystemTime(reinterpret_cast(&li), &st); @@ -44,7 +45,7 @@ TEST(utils, convert_api_date) { EXPECT_EQ(17, lt.wHour); EXPECT_EQ(50, lt.wMinute); EXPECT_EQ(30, lt.wSecond); - EXPECT_EQ(0, lt.wMilliseconds); + EXPECT_EQ(111, lt.wMilliseconds); } #endif // defined(_WIN32)