diff options
Diffstat (limited to 'include/my_time.h')
-rw-r--r-- | include/my_time.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/my_time.h b/include/my_time.h index fdfe130c45f..68f9c2e739f 100644 --- a/include/my_time.h +++ b/include/my_time.h @@ -50,6 +50,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 |