diff -r c8b591736ce0 -r cb3be0b31d99 core/systems/LibrarySys.cpp --- a/core/systems/LibrarySys.cpp Sun Dec 02 02:05:55 2007 +0000 +++ b/core/systems/LibrarySys.cpp Sun Dec 02 02:10:37 2007 +0000 @@ -29,6 +29,7 @@ * Version: $Id$ */ +#include #include #include #include @@ -396,3 +397,32 @@ /* We scanned and found no path separator */ return UTIL_Format(buffer, maxlength, "%s", path); } + +bool LibrarySystem::FileTime(const char *path, FileTimeType type, time_t *pTime) +{ +#ifdef PLATFORM_WINDOWS + struct _stat s; + if (_stat(path, &s) != 0) +#elif defined PLATFORM_POSIX + struct stat s; + if (stat(path, &s) != 0) +#endif + { + return false; + } + + if (type == FileTime_LastAccess) + { + *pTime = s.st_atime; + } + else if (type == FileTime_Created) + { + *pTime = s.st_ctime; + } + else if (type == FileTime_LastChange) + { + *pTime = s.st_mtime; + } + + return true; +}