summaryrefslogtreecommitdiffstats
path: root/src/OSSupport/File.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2016-11-07 23:15:07 +0100
committerAlexander Harkness <me@bearbin.net>2016-12-12 15:32:32 +0100
commit8c6d0b51c719e1817e308375d129b17ede3b82fc (patch)
tree8aa23d1db5e4198f6aeed5091ad6adedc12fea35 /src/OSSupport/File.cpp
parentMerge pull request #3476 from Seadragon91/patch-1 (diff)
downloadcuberite-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 '')
-rw-r--r--src/OSSupport/File.cpp6
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)));