Add convenient function to get file modified time in unix time

This commit is contained in:
Henrik Rydgård committed 2025-01-23 10:16:50 +01:00
1 parent 14f07ac073
commit c4a432e467
2 files changed
+13

No files matched your search

+11
View File
@@ -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;
+2
View File
@@ -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);