Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Feb 2005 21:16:00 -0200
From:      Marcus Grando <marcus@corp.grupos.com.br>
To:        freebsd-stable@freebsd.org, Marcus Grando <marcus@corp.grupos.com.br>
Subject:   mktime() bug? result strtotime() fail in PHP
Message-ID:  <420D3CB0.2030101@corp.grupos.com.br>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?420D3CB0.2030101>