mktime() bug? result strtotime() fail in PHP

Marcus Grando marcus at corp.grupos.com.br
Fri Feb 11 15:16:09 PST 2005


Hi,

I have problems with mktime() on FreeBSD 4.11-STABLE and daylight timezone.

My timezone is "America/Sao_Paulo", daylight begin on 2004-11-02 00:00 
and terminate on 2005-02-20 00:00.

The problem is:
If run this code[1] on FreeBSD 4.11-STABLE, then return -1, if run on 
FreeBSD 5.3-STABLE, then return 1099364400 (correct) and if run on 
Linux, then return 1099364400 (correct).

In PHP, strtotime() call mktime(), because that return error.

Is a bug on mktime()?

-- code[1] --
#include <stdio.h>
#include <time.h>

int main()
{
         struct tm local;

         local.tm_sec = 0;
         local.tm_min = 0;
         local.tm_hour = 0;
         local.tm_mday = 2;
         local.tm_mon = 10;
         local.tm_year = 104;
         local.tm_isdst = -1;

         printf("%i\n", mktime(&local));
}
-- code[1] --

Regards

-- 
Marcus Grando
Grupos Internet S/A
marcus(at)corp.grupos.com.br


More information about the freebsd-stable mailing list