diff --git a/Common/File/DirListing.cpp b/Common/File/DirListing.cpp index bd027a21ce..e6140f1052 100644 --- a/Common/File/DirListing.cpp +++ b/Common/File/DirListing.cpp @@ -137,6 +137,17 @@ bool GetFileInfo(const Path &path, FileInfo * fileInfo) { return true; } +bool GetModifTimeT(const Path &filename, time_t *return_time) { + FileInfo info; + if (GetFileInfo(filename, &info)) { + *return_time = info.mtime; + return true; + } else { + *return_time = 0; + return false; + } +} + bool GetModifTime(const Path &filename, tm & return_time) { memset(&return_time, 0, sizeof(return_time)); FileInfo info; diff --git a/Common/File/FileUtil.h b/Common/File/FileUtil.h index b49c539653..858c09072d 100644 --- a/Common/File/FileUtil.h +++ b/Common/File/FileUtil.h @@ -70,6 +70,8 @@ bool IsDirectory(const Path &filename); // Returns struct with modification date of file bool GetModifTime(const Path &filename, tm &return_time); +// Same but with unix timestamp +bool GetModifTimeT(const Path &filename, time_t *return_time); // the time_t, of course, matches time_now_unix_utc(). // Returns the size of filename (64bit) uint64_t GetFileSize(const Path &filename);