mktime problem...

php.internals

Jonathan Hernandez

22 years ago
Hello, I have a problem with mktime, when I try to run this: <?php $date = getdate(mktime(12, 0, 0, 1, 1 ,1959)); echo $date[0]." ".$date['mday']."-".$date['mon']."-".$date['year']."<br/>"; $date = getdate(-347090400); echo $date[0]." ".$date['mday']."-".$date['mon']."-".$date['year']."<br/>"; ?> Output: -62 31-12-1969 -347090400 1-1-1959 I compile php5.0b3 on Fedora(gcc 3.3.2/ kernel 2.4.22), if I try to run it on Debian (gcc 2.95.4 / kernel 2.6.0) it works fine, Output: -347090400 1-1-1959 -347090400 1-1-1959 Both php are compiled with the same ./configure line... Any idea about this? Thanks in advance, Jonathan http://ion.gluch.org.mx

Wez Furlong

22 years ago
Your libc doesn't support negative time_t values. --Wez. ----- Original Message ----- From: "Jonathan Hernandez" <ion@gluch.org.mx> To: <internals@lists.php.net> Sent: Monday, January 19, 2004 7:20 PM Subject: [PHP-DEV] mktime problem...

Jonathan Hernandez

22 years ago
Well, I see that is a normal behavior of libc/mktime (it returns -1 if an error was detected), I see others have the same problem and implements their own php/mktime function (see the first comment on http://www.php.net/mktime)... I wonder if it can be implemented directly on the php function... On Mon, 2004-01-19 at 13:05, Wez Furlong wrote: