fgerlits commented on code in PR #1560:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1560#discussion_r1185859999


##########
libminifi/src/utils/file/FileUtils.cpp:
##########
@@ -66,21 +66,21 @@ bool contains(const std::filesystem::path& file_path, 
std::string_view text_to_s
   return std::search(view.begin(), view.end(), searcher) != view.end();
 }
 
-time_t to_time_t(std::filesystem::file_time_type file_time) {
-#if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 14000
-  return std::chrono::file_clock::to_time_t(file_time);
+std::chrono::system_clock::time_point to_sys(std::filesystem::file_time_type 
file_time) {
+  using namespace std::chrono;  // NOLINT(build/namespaces)
+#if defined(WIN32) || (defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION < 14000))
+  return system_clock::now() + duration_cast<system_clock::duration>(file_time 
- file_clock::now());

Review Comment:
   I see, this is unfortunate.
   
   I think hard-coding the epoch differences 
(`std::filesystem::__std_fs_file_time_epoch_adjustment` in the case of Windows, 
and `0` in the case of `libc++ < 14`) is the least bad option.



-- 
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

Reply via email to