Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Feb 2005 07:51:04 +1100
From:      Peter Jeremy <PeterJeremy@optushome.com.au>
To:        Marcus Grando <marcus@corp.grupos.com.br>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: mktime() bug? result strtotime() fail in PHP
Message-ID:  <20050212205104.GF62061@cirb503493.alcatel.com.au>
In-Reply-To: <420D3CB0.2030101@corp.grupos.com.br>
References:  <420D3CB0.2030101@corp.grupos.com.br>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 2005-Feb-11 21:16:00 -0200, Marcus Grando wrote:
>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).

To be pedantic, FreeBSD 4.11 is correct and the others are wrong.  If
DST started at 2004-11-02 00:00 local time then you can't convert a local
time of 2004-11-02 00:00:00 because that time doesn't exist - your local
time goes 2004-11-01 23:59:59, 2004-11-02 01:00:00, 2004-11-02 01:00:01.

server% TZ=':/usr/share/zoneinfo/America/Sao_Paulo' perl -e 'print scalar localtime 1099364400,"\n";'
Tue Nov  2 01:00:00 2004
server% TZ=':/usr/share/zoneinfo/America/Sao_Paulo' perl -e 'print scalar localtime 1099364399,"\n";'   
Mon Nov  1 23:59:59 2004
server% 

-- 
Peter Jeremy



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