Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Feb 2005 09:53:24 -0200
From:      Marcus Grando <marcus@corp.grupos.com.br>
To:        Peter Jeremy <PeterJeremy@optushome.com.au>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: mktime() bug? result strtotime() fail in PHP
Message-ID:  <421485B4.1070102@corp.grupos.com.br>
In-Reply-To: <20050214184909.GH57256@cirb503493.alcatel.com.au>
References:  <420D3CB0.2030101@corp.grupos.com.br> <20050212205104.GF62061@cirb503493.alcatel.com.au> <4210941E.7070202@corp.grupos.com.br> <20050214184909.GH57256@cirb503493.alcatel.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

Peter Jeremy wrote:
>>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.
> 

Then, it's wrong.

> 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.
> 

Because of that:

<?php
putenv("TZ=America/Sao_Paulo");
echo $i = strtotime("2004-11-01"), "\n";
echo strtotime("+1 day", $i), "\n";
?>

-- 
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?421485B4.1070102>