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


##########
extensions/standard-processors/tests/unit/ListFileTests.cpp:
##########
@@ -107,8 +104,12 @@ TEST_CASE_METHOD(ListFileTestFixture, "Input Directory is 
empty", "[testListFile
   REQUIRE_THROWS_AS(test_controller_.runSession(plan_, true), 
minifi::Exception);
 }
 
+std::string get_last_modified_time_formatted_string(const 
std::filesystem::path& path) {
+  return date::format("%Y-%m-%dT%H:%M:%SZ", 
std::chrono::time_point_cast<std::chrono::seconds>(utils::file::to_sys(*utils::file::last_write_time(path))));

Review Comment:
   we have the formatting part of this in `utils::timeutils::getDateTimeStr()`



##########
libminifi/test/unit/FileUtilsTests.cpp:
##########
@@ -477,3 +477,27 @@ TEST_CASE("FileUtils::get_relative_path", 
"[TestGetRelativePath]") {
   REQUIRE(*FileUtils::get_relative_path(path, base_path / "") == 
std::filesystem::path("subdir") / "file.log");
   REQUIRE(*FileUtils::get_relative_path(base_path, base_path) == ".");
 }
+
+TEST_CASE("file_clock to system_clock conversion tests") {
+  using namespace std::chrono;
+
+  static_assert(system_clock::duration::period::num == 
file_clock::duration::period::num);
+  constexpr auto lowest_den = system_clock::period::den < 
file_clock::period::den ? system_clock::period::den : file_clock::period::den;

Review Comment:
   `std::min` doesn't work here?



##########
libminifi/test/unit/FileUtilsTests.cpp:
##########
@@ -477,3 +477,27 @@ TEST_CASE("FileUtils::get_relative_path", 
"[TestGetRelativePath]") {
   REQUIRE(*FileUtils::get_relative_path(path, base_path / "") == 
std::filesystem::path("subdir") / "file.log");
   REQUIRE(*FileUtils::get_relative_path(base_path, base_path) == ".");
 }
+
+TEST_CASE("file_clock to system_clock conversion tests") {
+  using namespace std::chrono;
+
+  static_assert(system_clock::duration::period::num == 
file_clock::duration::period::num);
+  constexpr auto lowest_den = system_clock::period::den < 
file_clock::period::den ? system_clock::period::den : file_clock::period::den;
+  using LeastPreciseDurationType = 
duration<std::common_type_t<system_clock::duration::rep, 
file_clock::duration::rep>, std::ratio<system_clock::duration::period::num, 
lowest_den>>;

Review Comment:
   minor, but it's slightly confusing that you sometimes write 
`x_clock::period` and sometimes `x_clock::duration::period`; I would use the 
shorter form everywhere



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