MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / Updater_SetNewBuildTime

Function Updater_SetNewBuildTime

src/Platform_Windows.c:927–946  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

925/* Don't need special execute permission on windows */
926cc_result Updater_MarkExecutable(void) { return 0; }
927cc_result Updater_SetNewBuildTime(cc_uint64 timestamp) {
928 static const cc_string path = String_FromConst(UPDATE_FILE);
929 cc_filepath str;
930 cc_file file;
931 FILETIME ft;
932 cc_uint64 raw;
933 cc_result res;
934
935 Platform_EncodePath(&str, &path);
936 res = File_OpenOrCreate(&file, &str);
937 if (res) return res;
938
939 raw = 10000000 * (timestamp + FILETIME_UNIX_EPOCH);
940 ft.dwLowDateTime = (cc_uint32)raw;
941 ft.dwHighDateTime = (cc_uint32)(raw >> 32);
942
943 if (!SetFileTime(file, NULL, NULL, &ft)) res = GetLastError();
944 File_Close(file);
945 return res;
946}
947
948
949/*########################################################################################################################*

Callers

nothing calls this directly

Calls 3

Platform_EncodePathFunction · 0.70
File_OpenOrCreateFunction · 0.70
File_CloseFunction · 0.70

Tested by

no test coverage detected