Re: Bug #1529: gmmktime is broken
| From: | Sascha Schumann | Date: | Fri, 11 Jun 1999 20:41:47 +0000 |
| Subject: | Re: Bug #1529: gmmktime is broken | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-6833@lists.php.net to get a copy of this message | ||
On Fri, Jun 11, 1999 at 07:30:00PM -0000, egon@tradeservices.com wrote:
> From: egon@tradeservices.com
> Operating system: Linux
> PHP version: 3.0.9
> PHP Bug Type: Misbehaving function
> Bug description: gmmktime is broken
>
> in functions/datetime.c, the code for translate to GMT is broken. The (I think) fixed version
> would look like this:
Care to elaborate? It seems to break in the case when gmadjust is
greater than tm_hour. Did you mean that?
The following piece of your code seems to be buggy:
> if (gm) {
> #if HAVE_TM_GMTOFF
> gmadjust=(tn->tm_gmtoff)/3600;
> #else
> gmadjust=timezone/3600;
> #endif
> }
>
> ta.tm_hour+=gmadjust;
The GMT adjustment must be subtracted. Adding it will result in a
GMT * 2 offset which is certainly not the thing you want.
--
Regards,
Sascha Schumann
Consultant