ID: 8242
Updated by: david
Reported By: [EMAIL PROTECTED]
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] [EMAIL PROTECTED]
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


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to