mktime() bug? result strtotime() fail in PHP
Peter Jeremy
PeterJeremy at optushome.com.au
Mon Feb 14 10:49:37 PST 2005
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
More information about the freebsd-stable
mailing list