Bug #38268 | Timestamp differs by 1 day | ||
---|---|---|---|
Submitted: | 21 Jul 2008 18:19 | Modified: | 10 Mar 2015 15:46 |
Reporter: | Joerg Bruehe | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 5.1.26-rc,6.0.6 | OS: | Windows (64 bit only) |
Assigned to: | Assigned Account | CPU Architecture: | Any |
[21 Jul 2008 18:19]
Joerg Bruehe
[21 Aug 2008 21:29]
Patrick Crews
Update on findings: Was able to replicate this on 32 bit Windows XP. This issue is limited to 3 specific dates: 19700102000001 19700103000001 19700104000001 Other dates tested worked properly. I suspect this is an error that occurs during the write process as TIMESTAMP(19700102000001) will convert to the proper date (no day decrement).
[24 Oct 2008 12:34]
Tatiana Azundris Nuernberg
Observations: - This doesn't happen when TIME_ZONE = 'UTC' (which makes it tempting to blame localtime-to-UTC conversion on store for TIMESTAMP, and UTC-to-localtime on retrieve, see also Bug#38455). (Of course, with TIME_ZONE != UTC, we might also end up correcting-for-store to before epoch, in which case we'll end up with a broken date (0).) - This ALSO doesn't seem to happen if we set up TIME_ZONE, so that seems to hotfix right there - On my linux machine if I don't set up TIME_ZONE explictly, I see (for actual local time 2pm, UTC noon), Helsinki 3pm: select localtimestamp(),unix_timestamp(),utc_timestamp(); localtimestamp() unix_timestamp() utc_timestamp() 2008-10-24 15:09:54 1224850194 2008-10-24 12:09:54 SELECT @@SESSION.TIME_ZONE; @@SESSION.TIME_ZONE SYSTEM $ date Fri Oct 24 14:14:13 CEST 2008 ("date" is correct, mysqld's UTC is correct, mysqld's "SYSTEM" TZ seems to assume Helsinki. Fair enough.) vs Windows: select localtimestamp(),unix_timestamp(),utc_timestamp(); localtimestamp() unix_timestamp() utc_timestamp() 2008-10-24 16:01:30 1224849690 2008-10-24 12:01:30 SELECT @@SESSION.TIME_ZONE; @@SESSION.TIME_ZONE SYSTEM $ date Fri Oct 24 08:02:55 EDT 2008 ("date" is correct for EDT, which is my Win's localtime; mysqld's UTC is correct, but mysqld seems to think my local time is Moscow's.) So interestingly in this case, mysqld's idea of localtime is neither the respective system's, nor UTC, nor as one might expect, something normative (Helsinki). DangerMouse to the rescue!
[10 Mar 2015 15:46]
Erlend Dahl
Can't repeat on recent versions (5.6+).