summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/config-win.h5
-rw-r--r--include/my_time.h13
2 files changed, 18 insertions, 0 deletions
diff --git a/include/config-win.h b/include/config-win.h
index f802bbbbad8..939c3ae6f88 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -169,6 +169,11 @@ typedef uint rf_SetTimer;
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF_OFF_T 8
+/*
+ The size of time_t depends on the compiler.
+ But it's 8 for all the supported VC versions.
+*/
+#define SIZEOF_TIME_T 8
#ifdef _WIN64
#define SIZEOF_CHARP 8
#else
diff --git a/include/my_time.h b/include/my_time.h
index 58995f1bf62..0bbb83b78b7 100644
--- a/include/my_time.h
+++ b/include/my_time.h
@@ -52,6 +52,19 @@ typedef long my_time_t;
/* two-digit years < this are 20..; >= this are 19.. */
#define YY_PART_YEAR 70
+/*
+ check for valid times only if the range of time_t is greater than
+ the range of my_time_t
+*/
+#if SIZEOF_TIME_T > 4 || defined(TIME_T_UNSIGNED)
+# define IS_TIME_T_VALID_FOR_TIMESTAMP(x) \
+ ((x) <= TIMESTAMP_MAX_VALUE && \
+ (x) >= TIMESTAMP_MIN_VALUE)
+#else
+# define IS_TIME_T_VALID_FOR_TIMESTAMP(x) \
+ ((x) >= TIMESTAMP_MIN_VALUE)
+#endif
+
/* Flags to str_to_datetime */
#define TIME_FUZZY_DATE 1
#define TIME_DATETIME_ONLY 2