diff --git a/xpdev/CMakeLists.txt b/xpdev/CMakeLists.txt
index 8923a397349c9e0a5080ec5ff6d7d0509c5d9c14..0a692e19f14f264d297337f61d48f572af869de0 100644
--- a/xpdev/CMakeLists.txt
+++ b/xpdev/CMakeLists.txt
@@ -124,7 +124,7 @@ if(HAS_DEV_MACHINE_SPKR_H)
 endif()
 
 if(WIN32)
-	target_compile_definitions(xpdev PUBLIC _WIN32 _WIN32_WINNT=0x0501 WINVER=0x0501 _WIN32_IE=0x0500)
+	target_compile_definitions(xpdev PUBLIC _WIN32 _WIN32_WINNT=0x0501 WINVER=0x0501 MSVCRT_VERSION=0x0501 _WIN32_IE=0x0500)
 	target_link_libraries(xpdev iphlpapi ws2_32 winmm netapi32)
 elseif(CMAKE_SYSTEM_NAME STREQUAL "Haiku")
 	target_link_libraries(xpdev network m)
diff --git a/xpdev/datewrap.h b/xpdev/datewrap.h
index 843de233ce0894272f0bb0e4603d9d2ae78bf437..c57cd9447f357a5cb0ff3cae2f564b353970bebd 100644
--- a/xpdev/datewrap.h
+++ b/xpdev/datewrap.h
@@ -57,7 +57,7 @@ DLLEXPORT struct tm*	localtime32(const time32_t* t, struct tm* tm);
 
 /* Microsoft's equivalent of GLIBC/BSD timegm() */
 #if defined(_MSC_VER) || defined(__MINGW32__)
-	#define timegm _mkgmtime32
+	#define timegm _mkgmtime
 #endif
 
 /***********************************/