fileutils: move API to std::filesystem, cleanup

Change-Id: I5408d193bda6830395bd705371c86c949643ee74
diff --git a/src/security/diffie-hellman.cpp b/src/security/diffie-hellman.cpp
index 78f901f..216e233 100644
--- a/src/security/diffie-hellman.cpp
+++ b/src/security/diffie-hellman.cpp
@@ -19,6 +19,7 @@
 
 #include <chrono>
 #include <ciso646>
+#include <filesystem>
 
 namespace dhtnet {
 namespace tls {
@@ -103,12 +104,13 @@
 }
 
 DhParams
-DhParams::loadDhParams(const std::string& path)
+DhParams::loadDhParams(const std::filesystem::path& path)
 {
     std::lock_guard<std::mutex> l(fileutils::getFileLock(path));
     try {
         // writeTime throw exception if file doesn't exist
-        auto duration = std::chrono::system_clock::now() - fileutils::writeTime(path);
+        auto writeTime = std::filesystem::last_write_time(path);
+        auto duration = decltype(writeTime)::clock::now() - writeTime;
         if (duration >= std::chrono::hours(24 * 3)) // file is valid only 3 days
             throw std::runtime_error("file too old");