mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-32188 make TIMESTAMP use whole 32-bit unsigned range
This patch extends the timestamp from 2038-01-19 03:14:07.999999 to 2106-02-07 06:28:15.999999 for 64 bit hardware and OS where 'long' is 64 bits. This is true for 64 bit Linux but not for Windows. This is done by treating the 32 bit stored int as unsigned instead of signed. This is safe as MariaDB has never accepted dates before the epoch (1970). The benefit of this approach that for normal timestamp the storage is compatible with earlier version. However for tables using system versioning we before stored a timestamp with the year 2038 as the 'max timestamp', which is used to detect current values. This patch stores the new 2106 year max value as the max timestamp. This means that old tables using system versioning needs to be updated with mariadb-upgrade when moving them to 11.4. That will be done in a separate commit.
This commit is contained in:
@@ -19,15 +19,14 @@
|
||||
|
||||
/*
|
||||
Portable time_t replacement.
|
||||
Should be signed and hold seconds for 1902 -- 2038-01-19 range
|
||||
i.e at least a 32bit variable
|
||||
For 32 bit systems holds seconds for 1970 - 2038-01-19 range
|
||||
For 64 bit systems (where long is 64 bit) holds seconds for 1970 - 2106
|
||||
|
||||
Using the system built in time_t is not an option as
|
||||
we rely on the above requirements in the time functions
|
||||
*/
|
||||
typedef long my_time_t;
|
||||
|
||||
|
||||
/*
|
||||
Time declarations shared between the server and client API:
|
||||
you should not add anything to this header unless it's used
|
||||
|
Reference in New Issue
Block a user