Re: Re: cvs: php4 /ext/standard datetime.c
| From: | Yasuo Ohgaki | Date: | Wed, 25 Sep 2002 03:34:49 +0000 |
| Subject: | Re: Re: cvs: php4 /ext/standard datetime.c | ||
| References: | 1 2 3 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-88584@lists.php.net to get a copy of this message | ||
Ilia A. wrote:
> '"time_t" is not defined for negative values and results may be
> unpredictable'.
>
> As I understand this statement, if you rely on a valid output when given a
> negative value you make your code dependant on an OS. Even though your code
> may work on Linux, it'll not work on Windows and possibly other OSes.
> The problem is that on Windows if a negative value is passed to localtime
> function Windows will core, as can be shown by this example: php -r "
> mktime(0,0,0,1,1,1932); ".
That's too bad...
>
> I think a better solution would be a ifdef in the datetime.c that would
> prevent negative values from being passed along to localtime() on Windows.
> And return an error specifying that current OS does not support negative
> values.
>
> What do you think?
No objection to your solution :)
--
Yasuo Ohgaki
>
> Ilia
>
>
> On September 24, 2002 10:43 pm, Yasuo Ohgaki wrote:
>
>>Many systems are optimized to deal with time earlier than
>>epoch, I suppose. Negative value works fine for me at least
>>and this patch breaks my script for sure.
>>
>>Behavior may be system dependent, that's why standard
>>do not define behavior. I think this is a documentation
>>problem but a consistency.
>>
>>I'm -1 for this change.
>>How about others?
>
>
>
>
>