Re: Re: PHP 4.0 Bug #8242 Updated: the date('B') gives bogus output when system date is Thu Dec 14 01:56:02 EET 20

From: Date: Wed, 10 Jan 2001 20:47:52 +0000
Subject: Re: Re: PHP 4.0 Bug #8242 Updated: the date('B') gives bogus output when system date is Thu Dec 14 01:56:02 EET 20
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-43729@lists.php.net to get a copy of this message
probably not, but if we're guaranteeing never to write more than 3 bytes to the buffer then it's worth a failsafe David On Wed, 10 Jan 2001, Boian Bonev wrote: > hi, > > i see you take care about timezones with offset bigger than one day... is it > possible? > > thank you :)) > > b. > > ----- Original Message ----- > From: "Bug Database" <php-dev@lists.php.net> > To: <boian@bonev.com> > Sent: Wednesday, January 10, 2001 8:49 AM > Subject: PHP 4.0 Bug #8242 Updated: the date('B') gives bogus output when > system date is Thu Dec 14 01:56:02 EET 20 > > > > ID: 8242 > > Updated by: david > > Reported By: boian@bonev.com > > Old-Status: Open > > Status: Closed > > Bug Type: Date/time related > > Assigned To: > > Comments: > > > > fixed with: > > while (beat < 0) { > > beat += 1000; > > } > > beat = beat % 1000; > > > > Swatch Internet Time is very, very sad. > > > > Previous Comments: > > -------------------------------------------------------------------------- > - > > > > [2000-12-13 18:59:39] boian@bonev.com > > Sometimes in tzones GMT+something the calculation below can give negative > or time greater than 1000 > > > > the fix just checks both cases since timezone cannot add more than a day > (or less respectively) or in other terms 1000 swatch beats > > > > case 'B': /* Swatch Beat a.k.a. Internet Time */ > > beat = (((((long)the_time)-(((long)the_time) - > > ((((long)the_time) % 86400) + 3600))) * 10) / 864); > > > > -- the fix -- > > > > if (beat < 0) beat += 1000; > > if (beat > 999) beat -= 1000; > > > > -- end fix -- > > > > sprintf(tmp_buff, "%03d", beat); /* SAFE */ > > strcat(return_value->value.str.val, tmp_buff); > > break; > > > > -------------------------------------------------------------------------- > - > > > > > > Full Bug description available at: > > http://bugs.php.net/?id=8242 > > > > > > >

« previous php.dev (#43729) next »