diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2016-11-07 23:15:07 +0100 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2016-12-12 15:32:32 +0100 |
commit | 8c6d0b51c719e1817e308375d129b17ede3b82fc (patch) | |
tree | 8aa23d1db5e4198f6aeed5091ad6adedc12fea35 /src/OSSupport/File.cpp | |
parent | Merge pull request #3476 from Seadragon91/patch-1 (diff) | |
download | cuberite-8c6d0b51c719e1817e308375d129b17ede3b82fc.tar cuberite-8c6d0b51c719e1817e308375d129b17ede3b82fc.tar.gz cuberite-8c6d0b51c719e1817e308375d129b17ede3b82fc.tar.bz2 cuberite-8c6d0b51c719e1817e308375d129b17ede3b82fc.tar.lz cuberite-8c6d0b51c719e1817e308375d129b17ede3b82fc.tar.xz cuberite-8c6d0b51c719e1817e308375d129b17ede3b82fc.tar.zst cuberite-8c6d0b51c719e1817e308375d129b17ede3b82fc.zip |
Diffstat (limited to 'src/OSSupport/File.cpp')
-rw-r--r-- | src/OSSupport/File.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/OSSupport/File.cpp b/src/OSSupport/File.cpp index a59f599ae..062161144 100644 --- a/src/OSSupport/File.cpp +++ b/src/OSSupport/File.cpp @@ -653,9 +653,13 @@ unsigned cFile::GetLastModificationTime(const AString & a_FileName) { return 0; } - #ifdef _WIN32 + #if defined(_WIN32) // Windows returns times in local time already return static_cast<unsigned>(st.st_mtime); + #elif defined(ANDROID) + // Identical to Linux below, but st_mtime is an unsigned long, so cast is needed: + auto Time = static_cast<time_t>(st.st_mtime); + return static_cast<unsigned>(mktime(localtime(&Time))); #else // Linux returns UTC time, convert to local timezone: return static_cast<unsigned>(mktime(localtime(&st.st_mtime))); |