MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / getDateModified

Function getDateModified

src/Engine/CrossPlatform.cpp:786–812  ·  view source on GitHub ↗

* Gets the last modified date of a file. * @param path Full path to file. * @return The timestamp in integral format. */

Source from the content-addressed store, hash-verified

784 * @return The timestamp in integral format.
785 */
786time_t getDateModified(const std::string &path)
787{
788/*#ifdef _WIN32
789 WIN32_FILE_ATTRIBUTE_DATA info;
790 if (GetFileAttributesExA(path.c_str(), GetFileExInfoStandard, &info))
791 {
792 FILETIME ft = info.ftLastWriteTime;
793 LARGE_INTEGER li;
794 li.HighPart = ft.dwHighDateTime;
795 li.LowPart = ft.dwLowDateTime;
796 return li.QuadPart;
797 }
798 else
799 {
800 return 0;
801 }
802#endif*/
803 struct stat info;
804 if (stat(path.c_str(), &info) == 0)
805 {
806 return info.st_mtime;
807 }
808 else
809 {
810 return 0;
811 }
812}
813
814/**
815 * Converts a date/time into a human-readable string

Callers 1

getSaveInfoMethod · 0.85

Calls 1

statClass · 0.85

Tested by

no test coverage detected