fgerlits commented on code in PR #1560: URL: https://github.com/apache/nifi-minifi-cpp/pull/1560#discussion_r1169687229
########## libminifi/src/utils/file/FileUtils.cpp: ########## @@ -74,13 +74,23 @@ time_t to_time_t(std::filesystem::file_time_type file_time) { #endif } -std::chrono::time_point<std::chrono::system_clock> to_sys(std::filesystem::file_time_type file_time) { -#if defined(WIN32) || defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 14000 - return std::chrono::time_point_cast<std::chrono::system_clock::duration>(file_time - std::filesystem::file_time_type::clock::now() + std::chrono::system_clock::now()); -#elif defined(_LIBCPP_VERSION) +std::chrono::system_clock::time_point to_sys(std::filesystem::file_time_type file_time) { +#if defined(WIN32) + return std::chrono::clock_cast<std::chrono::system_clock>(file_time); +#elif defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION < 14000) return std::chrono::system_clock::from_time_t(std::chrono::file_clock::to_time_t(file_time)); #else - return std::chrono::file_clock::to_sys(file_time); + return std::chrono::time_point_cast<std::chrono::system_clock::duration>(std::chrono::file_clock::to_sys(file_time)); +#endif +} + +std::filesystem::file_time_type from_sys(std::chrono::system_clock::time_point sys_time) { +#if defined(WIN32) + return std::chrono::clock_cast<std::chrono::file_clock>(sys_time); +#elif defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION < 14000) + return std::chrono::file_clock::from_time_t(std::chrono::system_clock::to_time_t(sys_time)); +#else + return std::chrono::file_clock::from_sys(sys_time); Review Comment: I don't get it. If `std::chrono::file_clock::to_sys(file_time)` returns nanoseconds and needs to be duration-cast to microseconds, then doesn't `std::chrono::file_clock::from_sys(sys_time)` return microseconds and needs to be duration-cast to nanoseconds? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org