At 11:04 PM +0200 6/19/01, Attila Soki wrote:
>| Paul DuBois [mailto:[EMAIL PROTECTED]]
>| When UNIX_TIMESTAMP is used on a TIMESTAMP column, the function will
>| receive the value directly, with no implicit
>| ``string-to-unix-timestamp'' conversion. If you give UNIX_TIMESTAMP() a
>| wrong or out-of-range date, it will return 0.
>
>second test:
>
>c with dates before 1970:
>---cut here ---
>#include <stdio.h>
>#include <time.h>
>
>int main(void)
>{
>       struct tm time_check;
>       time_t xtime;
>       char str[80];
>       int ts;
>
>       //1969-1-1 00:00:01
>       time_check.tm_year = 1969 - 1900;
>       time_check.tm_mon  = 1 - 1;
>       time_check.tm_mday = 1;
>       time_check.tm_hour = 0;
>       time_check.tm_min  = 0;
>       time_check.tm_sec  = 1;
>       time_check.tm_isdst = -1;
>
>       xtime=mktime(&time_check);
>       strftime(str, 80,"%#c",&time_check);
>       printf("time: %s\n",str);
>       return 0;
>}
>---cut here ---
>
>and the output:
>alpha:/home/atiware# ./ut
>time: Wed Jan  1 00:00:01 1969
>alpha:/home/atiware#
>
>same in MySql:
>mysql> select unix_timestamp('1969-1-1 00:00:01');                  
>+-------------------------------------+
>| unix_timestamp('1969-1-1 00:00:01') |
>+-------------------------------------+
>|                                   0 |
>+-------------------------------------+
>1 row in set (0.00 sec)
>
>
>why can C work with this date, and mysql why not?
>is this a bug or not?

It's a bug that MySQL performs as documented?

Does that C program work on all platforms where MySQL works?


>thanks.
>
>ati

-- 
Paul DuBois, [EMAIL PROTECTED]

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to