summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Hagander2007-12-11 14:34:43 +0000
committerMagnus Hagander2007-12-11 14:34:43 +0000
commit635457376cff5bd8e403d45c02c013dab3b18d43 (patch)
tree98626687d4bc0f9add368d1bb82735043b16f3ae
parent416efe39bee2b76e5cb187d9d29717eca581e296 (diff)
Use _USE_32BIT_TIME_T when building with MSVC. Also, enforce that it's
used when building addons. Dave Page
-rw-r--r--src/include/port/win32.h11
-rw-r--r--src/tools/msvc/Project.pm2
2 files changed, 12 insertions, 1 deletions
diff --git a/src/include/port/win32.h b/src/include/port/win32.h
index d232b8c376..540ffc6466 100644
--- a/src/include/port/win32.h
+++ b/src/include/port/win32.h
@@ -45,6 +45,17 @@
#define USES_WINSOCK
+/*
+ * Ensure that anyone building an extension is using a 32 bit time_t.
+ * On Mingw/Msys, that should always be the case, but MSVC++ defaults
+ * to 64 bits. We set that for our own build in the project files
+ */
+#ifdef WIN32_ONLY_COMPILER
+#ifndef _USE_32BIT_TIME_T
+#error "Postgres uses 32 bit time_t - add #define _USE_32BIT_TIME_T on Windows"
+#endif
+#endif
+
/* defines for dynamic linking on Win32 platform */
#if defined(WIN32) || defined(__CYGWIN__)
diff --git a/src/tools/msvc/Project.pm b/src/tools/msvc/Project.pm
index a81c3a27a3..e39505884b 100644
--- a/src/tools/msvc/Project.pm
+++ b/src/tools/msvc/Project.pm
@@ -489,7 +489,7 @@ sub WriteConfiguration
ConfigurationType="$cfgtype" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2" WholeProgramOptimization="$p->{wholeopt}">
<Tool Name="VCCLCompilerTool" Optimization="$p->{opt}"
AdditionalIncludeDirectories="$self->{prefixincludes}src/include;src/include/port/win32;src/include/port/win32_msvc;$self->{includes}"
- PreprocessorDefinitions="WIN32;_WINDOWS;__WINDOWS__;__WIN32__;EXEC_BACKEND;WIN32_STACK_RLIMIT=4194304;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE$self->{defines}$p->{defs}"
+ PreprocessorDefinitions="WIN32;_WINDOWS;__WINDOWS__;__WIN32__;EXEC_BACKEND;WIN32_STACK_RLIMIT=4194304;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T$self->{defines}$p->{defs}"
StringPooling="$p->{strpool}"
RuntimeLibrary="$p->{runtime}" DisableSpecificWarnings="$self->{disablewarnings}"
EOF