From 65884209c5af28504069b53ee7bb164417fbb9dd Mon Sep 17 00:00:00 2001 From: Florian Reimold <11774314+FlorianReimold@users.noreply.github.com> Date: Thu, 17 Oct 2024 09:04:09 +0200 Subject: [PATCH] Hotfix/modification time (#73) Fixed timestamps of files: - FineFTP now properly returns the modification time (it returned the file creation time before) - Switched to UTC timestamps. Before, the local time was returned, which caused inaccuracies if the server had any other timezone. --------- Co-authored-by: Guillaume Buisson <> --- fineftp-server/src/filesystem.cpp | 6 +++--- fineftp-server/version.cmake | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fineftp-server/src/filesystem.cpp b/fineftp-server/src/filesystem.cpp index f92de86..c95aa25 100644 --- a/fineftp-server/src/filesystem.cpp +++ b/fineftp-server/src/filesystem.cpp @@ -193,17 +193,17 @@ namespace Filesystem #if defined(__unix__) localtime_r(&now_time_t, &now_timeinfo); - localtime_r(&file_status_.st_ctime, &file_timeinfo); + gmtime_r (&file_status_.st_mtime, &file_timeinfo); #elif defined(_MSC_VER) localtime_s(&now_timeinfo, &now_time_t); - localtime_s(&file_timeinfo, &file_status_.st_ctime); + gmtime_s (&file_timeinfo, &file_status_.st_mtime); #else static std::mutex mtx; { std::lock_guard lock(mtx); now_timeinfo = *std::localtime(&now_time_t); - file_timeinfo = *std::localtime(&file_status_.st_ctime); + file_timeinfo = *std::gmtime (&file_status_.st_mtime); } #endif diff --git a/fineftp-server/version.cmake b/fineftp-server/version.cmake index 730153e..6a235a5 100644 --- a/fineftp-server/version.cmake +++ b/fineftp-server/version.cmake @@ -1,3 +1,3 @@ set(FINEFTP_SERVER_VERSION_MAJOR 1) set(FINEFTP_SERVER_VERSION_MINOR 4) -set(FINEFTP_SERVER_VERSION_PATCH 2) +set(FINEFTP_SERVER_VERSION_PATCH 3)