MySQL still can't handle TIMESTAMP after 2038
Bug #12654 | 64-bit unix timestamp is not supported in MySQL functions | ||
---|---|---|---|
Submitted: | 18 Aug 2005 17:38 | Modified: | 18 Oct 2005 23:50 |
Reporter: | Dmitry | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S4 (Feature request) |
Version: | 4.1, 5.0, 5.1, 5.5 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Triage: | D5 (Feature request) |
[18 Aug 2005 17:38] Dmitry
Description: // mysql-standard-4.1.13a-apple-darwin8.2.0-powerpc-64bit
both UNIX_TIMESTAMP() and FROM_UNIXTIME() don't work with unix timestamp after year of 2037
OS itself returns correct values in functions mktime() and gmtime() if compiled with "-m64" flag How to repeat: mysql> select unix_timestamp('2038-01-01');
+------------------------------+
| unix_timestamp('2038-01-01') |
+------------------------------+
| 0 |
+------------------------------+
1 row in set (0.00 sec)
mysql> select from_unixtime(2548990800);
+---------------------------+
| from_unixtime(2548990800) |
+---------------------------+
| NULL |
+---------------------------+
1 row in set (0.02 sec) Suggested fix: probably because of
sql/mysql_priv.h:
/* Time handling defaults */
#define TIMESTAMP_MAX_YEAR 2038
#define YY_PART_YEAR 70
#define TIMESTAMP_MIN_YEAR (1900 + YY_PART_YEAR - 1)
#define TIMESTAMP_MAX_VALUE 2145916799
#define TIMESTAMP_MIN_VALUE 1
#define PRECISION_FOR_DOUBLE 53
#define PRECISION_FOR_FLOAT 24
from Hacker News https://ift.tt/2PyObAM