MCPcopy Create free account
hub / github.com/ddnet/ddnet / fs_file_time

Function fs_file_time

src/base/fs.cpp:608–632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

606}
607
608int fs_file_time(const char *name, time_t *created, time_t *modified)
609{
610#if defined(CONF_FAMILY_WINDOWS)
611 WIN32_FIND_DATAW finddata;
612 const std::wstring wide_name = windows_utf8_to_wide(name);
613 HANDLE handle = FindFirstFileW(wide_name.c_str(), &finddata);
614 if(handle == INVALID_HANDLE_VALUE)
615 return 1;
616
617 *created = filetime_to_unixtime(&finddata.ftCreationTime);
618 *modified = filetime_to_unixtime(&finddata.ftLastWriteTime);
619 FindClose(handle);
620#elif defined(CONF_FAMILY_UNIX)
621 struct stat sb;
622 if(stat(name, &sb))
623 return 1;
624
625 *created = sb.st_ctime;
626 *modified = sb.st_mtime;
627#else
628#error not implemented
629#endif
630
631 return 0;
632}

Callers 3

RetrieveTimesMethod · 0.85
BeforeInitMethod · 0.85
fs_listdir_fileinfoFunction · 0.85

Calls 3

windows_utf8_to_wideFunction · 0.85
filetime_to_unixtimeFunction · 0.85
statClass · 0.70

Tested by

no test coverage detected