Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Feb 2005 05:49:10 +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:  <20050214184909.GH57256@cirb503493.alcatel.com.au>
In-Reply-To: <4210941E.7070202@corp.grupos.com.br>
References:  <420D3CB0.2030101@corp.grupos.com.br> <20050212205104.GF62061@cirb503493.alcatel.com.au> <4210941E.7070202@corp.grupos.com.br>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 2005-Feb-14 10:05:50 -0200, Marcus Grando wrote:
>Peter Jeremy wrote:
>>To be pedantic, FreeBSD 4.11 is correct and the others are wrong.  If
>                                                  ^^^^^^
>Also FreeBSD 5.3-STABLE?

I don't have a 5.3-STABLE system to confirm but if it doesn't return -1
it is wrong.

>>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.
>
>I know, but timestamp return is better of that -1.

What timestamp should it return?  2004-11-02 00:00:00 doesn't exist for
you, therefore there is no possible value for seconds since epoch that
will convert to this time.  The manpage states:
     until tm_mon and tm_year are determined.  The mktime() function returns
     the specified calendar time; if the calendar time cannot be represented,
     it returns -1;
Since 2004-11-02 00:00:00 cannot be represented, then it should return -1.

Maybe you should explain why having mktime() correctly report an error is
a problem for you.

-- 
Peter Jeremy



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