While I don't know for sure, my guess is that it would have something to
do with 32 bit as the magic number, but also...being that this won't
become a problem until
mysql> select from_unixtime(2147483647);
+---------------------------+
| from_unixtime(2147483647) |
+---------------------------+
| 2038-01-18 21:14:07 |
+---------------------------+
1 row in set (0.00 sec)
And the 64bit processors and OS's are going to start coming out soon...
As for your other issues...mine doesn't quite wrap like yours does.
mysql> select from_unixtime(2147483648);
+---------------------------+
| from_unixtime(2147483648) |
+---------------------------+
| 1901-12-13 14:45:52 |
+---------------------------+
1 row in set (0.00 sec)
and if we look at the start of time...
mysql> select from_unixtime(0);
+---------------------+
| from_unixtime(0) |
+---------------------+
| 1969-12-31 18:00:00 |
+---------------------+
1 row in set (0.00 sec)
This was done in 3.23.56-log on RH7.3
On Thu, 2003-08-07 at 09:27, Andy Jackman wrote:
> Hi,
> 1) I was investigating the unix_timestamp routine in mysql (version
> 3.23.46-nt) and for some reason the unix epoch (1-1-1970) was returned
> with a value of -3600. Then, as you can see, it suddenly corrected
> itself. I can't replicate this error, but it caused me to shudder.
> Attached is the output from the command line client.
> 2) The function from_unixtime(n) wraps on my server after 2^31 seconds.
> e.g. select from_unixtime(2147483648) returns "1900-01-00 00:00:00". I
> suspect this is caused by the underlying time_t size that mysql was
> compiled with. Is this so? Are any versions of mysql compiled with a
> larger time_t?
> Regards,
> Andy
>
> +---------------------------+
> | from_unixtime(2147483648) |
> +---------------------------+
> | 1900-01-00 00:00:00 |
> +---------------------------+
> 1 row in set (0.00 sec)
>
>
> mysql> select unix_timestamp();
> +------------------+
> | unix_timestamp() |
> +------------------+
> | 1060262715 |
> +------------------+
> 1 row in set (0.00 sec)
>
> mysql> select unix_timestamp('1970-01-01 00:00:00');
> +---------------------------------------+
> | unix_timestamp('1970-01-01 00:00:00') |
> +---------------------------------------+
> | -3600 |
> +---------------------------------------+
> 1 row in set (0.00 sec)
>
> mysql> select unix_timestamp('1970-01-01 00:00:01');
> +---------------------------------------+
> | unix_timestamp('1970-01-01 00:00:01') |
> +---------------------------------------+
> | -3599 |
> +---------------------------------------+
> 1 row in set (0.00 sec)
>
> mysql> select from_unixtime(0);
> +---------------------+
> | from_unixtime(0) |
> +---------------------+
> | 1970-01-01 00:00:00 |
> +---------------------+
> 1 row in set (0.00 sec)
>
> mysql> select unix_timestamp('1970-01-01 00:00:00');
> +---------------------------------------+
> | unix_timestamp('1970-01-01 00:00:00') |
> +---------------------------------------+
> | -3600 |
> +---------------------------------------+
> 1 row in set (0.00 sec)
>
> mysql> select unix_timestamp('1970-01-01 00:01:00');
> +---------------------------------------+
> | unix_timestamp('1970-01-01 00:01:00') |
> +---------------------------------------+
> | 60 |
> +---------------------------------------+
> 1 row in set (0.00 sec)
>
> mysql> select unix_timestamp('1970-01-01 00:02:00');
> +---------------------------------------+
> | unix_timestamp('1970-01-01 00:02:00') |
> +---------------------------------------+
> | 120 |
> +---------------------------------------+
> 1 row in set (0.00 sec)
>
> mysql> select unix_timestamp('1970-01-01 00:00:10');
> +---------------------------------------+
> | unix_timestamp('1970-01-01 00:00:10') |
> +---------------------------------------+
> | 10 |
> +---------------------------------------+
> 1 row in set (0.02 sec)
>
> mysql> select unix_timestamp('1970-01-01 00:00:09');
> +---------------------------------------+
> | unix_timestamp('1970-01-01 00:00:09') |
> +---------------------------------------+
> | 9 |
> +---------------------------------------+
> 1 row in set (0.00 sec)
>
> mysql> select unix_timestamp('1970-01-01 00:00:08');
> +---------------------------------------+
> | unix_timestamp('1970-01-01 00:00:08') |
> +---------------------------------------+
> | 8 |
> +---------------------------------------+
> 1 row in set (0.00 sec)
>
> mysql> select unix_timestamp('1970-01-01 00:00:07');
> +---------------------------------------+
> | unix_timestamp('1970-01-01 00:00:07') |
> +---------------------------------------+
> | 7 |
> +---------------------------------------+
> 1 row in set (0.00 sec)
>
> mysql> select unix_timestamp('1970-01-01 00:00:01');
> +---------------------------------------+
> | unix_timestamp('1970-01-01 00:00:01') |
> +---------------------------------------+
> | 1 |
> +---------------------------------------+
> 1 row in set (0.00 sec)
>
> mysql> select unix_timestamp('1970-01-01 00:00:00');
> +---------------------------------------+
> | unix_timestamp('1970-01-01 00:00:00') |
> +---------------------------------------+
> | 0 |
> +---------------------------------------+
> 1 row in set (0.00 sec)
>
>
> - Andy.
>
>
> mysql> select unix_timestamp('1970-01-01 00:00:00');
> +---------------------------------------+
> | unix_timestamp('1970-01-01 00:00:00') |
> +---------------------------------------+
> | -3600 |
> +---------------------------------------+
> 1 row in set (0.00 sec)
>
> mysql> select unix_timestamp('1970-01-01 00:00:01');
> +---------------------------------------+
> | unix_timestamp('1970-01-01 00:00:01') |
> +---------------------------------------+
> | -3599 |
> +---------------------------------------+
> 1 row in set (0.00 sec)
>
> <snip> - a little later in the same session:
>
> mysql> select unix_timestamp('1970-01-01 00:00:00');
> +---------------------------------------+
> | unix_timestamp('1970-01-01 00:00:00') |
> +---------------------------------------+
> | 0 |
> +---------------------------------------+
> 1 row in set (0.00 sec)
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
--
Woody
In a world without boundaries why
do we need Gates and Windows?
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]