List:General Discussion« Previous MessageNext Message »
From:Jay J Date:November 15 1999 1:21pm
Subject:Re: Bug in unix_timestamp()
View as plain text  
----- Original Message -----
From: <pandr@stripped>
To: <mysql@stripped>
Sent: Monday, November 15, 1999 6:52 AM
Subject: Bug in unix_timestamp()


> >Description:
>
>   The unix_timestamp is not well-defined, i.e. it may return different
> values for same argument.
>
> >How-To-Repeat:
>
>  select unix_timestamp('1999-10-31 01:59:59');
>  select unix_timestamp('1999-10-31 02:00:00');
>  select unix_timestamp('1999-10-31 03:00:00');
>  select unix_timestamp('1999-10-31 02:00:00');
>
> yields
>
>  941327999
>  941328000
>  941335200
>  941331600   !!!!!
>
> Note, this is of course only a problem because of the daylight-saving.
>

Are you sure you meant for the 2nd and 4th example to be identical?

That result you're questioning is: from_unixtime(941331600): 1999-10-30
20:00:00


mysql> status
--------------
mysql  Ver 9.32 Distrib 3.22.21, for pc-linux-gnu (i686)

mysql> select unix_timestamp('1999-10-31 01:59:59'),
unix_timestamp('1999-10-31 02:00:00'),unix_timestamp('1999-10-31 03:00:00'),
unix_timestamp('1999-10-31 02:00:00')
    -> ego
*************************** 1. row ***************************
unix_timestamp('1999-10-31 01:59:59'): 941356799
unix_timestamp('1999-10-31 02:00:00'): 941356800
unix_timestamp('1999-10-31 03:00:00'): 941360400
unix_timestamp('1999-10-31 02:00:00'): 941356800
1 row in set (0.01 sec)

.... and:

mysql> status
--------------
mysql  Ver 9.32 Distrib 3.22.23b, for pc-linux-gnu (i486)

mysql> select unix_timestamp('1999-10-31 01:59:59'),
unix_timestamp('1999-10-31 02:00:00'),unix_timestamp('1999-10-31 03:00:00'),
unix_timestamp('1999-10-31 02:00:00')
    -> ego
*************************** 1. row ***************************
unix_timestamp('1999-10-31 01:59:59'): 941356799
unix_timestamp('1999-10-31 02:00:00'): 941356800
unix_timestamp('1999-10-31 03:00:00'): 941360400
unix_timestamp('1999-10-31 02:00:00'): 941356800
1 row in set (0.01 sec)

mysql> select from_unixtime(941356800);
+--------------------------+
| from_unixtime(941356800) |
+--------------------------+
| 1999-10-31 02:00:00      |
+--------------------------+

-Jay J

Thread
Bug in unix_timestamp()pandr15 Nov
  • RE: Bug in unix_timestamp()Len Rose15 Nov
    • RE: Bug in unix_timestamp()Bob Kline15 Nov
      • Re: Bug in unix_timestamp()Gisle Aas15 Nov
        • Re: Bug in unix_timestamp()sinisa15 Nov
        • Re: Bug in unix_timestamp()Vivek Khera15 Nov
  • Re: Bug in unix_timestamp()Jay J15 Nov
  • Re: Bug in unix_timestamp()Jacob Joseph17 Nov
  • Re: Bug in unix_timestamp()Jacob Joseph17 Nov
Re: Bug in unix_timestamp()Gisle Aas15 Nov
  • Re: Bug in unix_timestamp()sinisa16 Nov
    • Re: Bug in unix_timestamp()Peter Andreasen16 Nov