Skip to content

Commit 6588420

Browse files
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 <>
1 parent 6824f20 commit 6588420

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

fineftp-server/src/filesystem.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -193,17 +193,17 @@ namespace Filesystem
193193

194194
#if defined(__unix__)
195195
localtime_r(&now_time_t, &now_timeinfo);
196-
localtime_r(&file_status_.st_ctime, &file_timeinfo);
196+
gmtime_r (&file_status_.st_mtime, &file_timeinfo);
197197
#elif defined(_MSC_VER)
198198
localtime_s(&now_timeinfo, &now_time_t);
199-
localtime_s(&file_timeinfo, &file_status_.st_ctime);
199+
gmtime_s (&file_timeinfo, &file_status_.st_mtime);
200200
#else
201201
static std::mutex mtx;
202202
{
203203
std::lock_guard<std::mutex> lock(mtx);
204204

205205
now_timeinfo = *std::localtime(&now_time_t);
206-
file_timeinfo = *std::localtime(&file_status_.st_ctime);
206+
file_timeinfo = *std::gmtime (&file_status_.st_mtime);
207207
}
208208
#endif
209209

fineftp-server/version.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
set(FINEFTP_SERVER_VERSION_MAJOR 1)
22
set(FINEFTP_SERVER_VERSION_MINOR 4)
3-
set(FINEFTP_SERVER_VERSION_PATCH 2)
3+
set(FINEFTP_SERVER_VERSION_PATCH 3)

0 commit comments

Comments
 (0)