Bug #8212 | UNIX_TIMESTAMP returns 0 instead of negative ints for dates between 1901-1970 | ||
---|---|---|---|
Submitted: | 31 Jan 2005 14:15 | Modified: | 4 Feb 2005 11:45 |
Reporter: | Peter van Dijk | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 4.0.18 | OS: | FreeBSD (FreeBSD 4.9-RELEASE-p4) |
Assigned to: | CPU Architecture: | Any |
[31 Jan 2005 14:15]
Peter van Dijk
[4 Feb 2005 11:40]
Dmitry Lenev
Hi, Peter! Actually POSIX does not say that time_t type which is type of return value of mktime()/time() C-functions after which MySQL's UNIX_TIMESTAMP() function was designed should be signed (actually it does not even require it to be integer but that is different story). So it does not require from implementations to correctly operate with datetime values which correspond to negative time_t values. Moreover it uses (time_t)-1 as error-indicating return value from these functions. (Example of platform where time_t is unsigned and where "negative" time_t (i.e. greater than 2^31-1) values correspond to dates in 21st century is QNX 6.) This means we simply can't implement UNIX_TIMESTAMP() which would accept datetime values prior to 1970-01-01 UTC in portable way and that MySQL matches POSIX in this sense. Probably we can implement simple wrapper over system's mktime() call which will meet your expectations on some systems... But this is definitely feature request and not a bug...
[4 Feb 2005 11:45]
Dmitry Lenev
Thus changing status of this bug report to "Not a Bug". Feel free to change its severity to "Feature request". Thank you for you interest in MySQL, Peter!
[4 Feb 2005 13:17]
Peter van Dijk
I can't seem to change the severity; could you change it to Feature request for me? Thank you for your time!