// TJP COPYRIGHT HEADER #ifdef TJP_CORE_HEADER_ONLY #pragma once #endif #include #include "times.hpp" #include #include #include #include namespace tjp::core::file { TJP_CORE_HEADER_ONLY_INLINE time_t getFileLastModifiedTime(const String & fullFileName) { struct stat status; int result = stat(fullFileName.c_str(), &status); if (result != 0) return 0; return status.st_mtime; } TJP_CORE_HEADER_ONLY_INLINE bool setFileLastModifiedTime(const String & fullFileName, time_t time) { struct utimbuf timbuf; timbuf.actime = getFileAccessTime(fullFileName); timbuf.modtime = time; int result = utime(fullFileName.c_str(), &timbuf); if (result != 0) return false; return true; } TJP_CORE_HEADER_ONLY_INLINE time_t getFileCreationTime (const String & fullFileName) { struct stat status; int result = stat(fullFileName.c_str(), &status); if (result != 0) return 0; return status.st_ctime; } TJP_CORE_HEADER_ONLY_INLINE time_t getFileAccessTime (const String & fullFileName) { struct stat status; int result = stat(fullFileName.c_str(), &status); if (result != 0) return 0; return status.st_atime; } } // namespace