Skip to content

Commit

Permalink
Hotfix/modification time (#73)
Browse files Browse the repository at this point in the history
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 <>
  • Loading branch information
FlorianReimold authored Oct 17, 2024
1 parent 6824f20 commit 6588420
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions fineftp-server/src/filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::mutex> 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

Expand Down
2 changes: 1 addition & 1 deletion fineftp-server/version.cmake
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 6588420

Please sign in to comment.