MCPcopy Create free account
hub / github.com/NetHack/NetHack / file_newer

Function file_newer

sys/windows/windmain.c:1150–1174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1148#endif /* PC_LOCKING */
1149
1150RESTORE_WARNING_UNREACHABLE_CODE
1151
1152/*
1153 file_newer returns TRUE if the file at a_path is newer then the file
1154 at b_path. If a_path does not exist, it returns FALSE. If b_path
1155 does not exist, it returns TRUE.
1156 */
1157boolean
1158file_newer(const char *a_path, const char *b_path)
1159{
1160 struct stat a_sb = { 0 };
1161 struct stat b_sb = { 0 };
1162 double timediff;
1163
1164 if (stat(a_path, &a_sb))
1165 return FALSE;
1166
1167 if (stat(b_path, &b_sb))
1168 return TRUE;
1169 timediff = difftime(a_sb.st_mtime, b_sb.st_mtime);
1170
1171 if(timediff > 0)
1172 return TRUE;
1173 return FALSE;
1174}
1175
1176#ifdef WIN32CON
1177/*

Callers 2

update_fileFunction · 0.85
copy_symbols_contentFunction · 0.85

Calls 1

statClass · 0.70

Tested by

no test coverage detected