From: David Croft Date: Wed, 10 Jan 2001 06:48:06 +0000 (+0000) Subject: fixed swatch internet time (bugs#8242,7106) X-Git-Tag: php-4.0.5RC1~633 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2b3d9d7ec454ea8d573158bc90970c58000718f6;p=php fixed swatch internet time (bugs#8242,7106) --- diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c index 159804d034..609df5d558 100644 --- a/ext/standard/datetime.c +++ b/ext/standard/datetime.c @@ -458,7 +458,10 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm) case 'B': /* Swatch Beat a.k.a. Internet Time */ beat = (((((long)the_time)-(((long)the_time) - ((((long)the_time) % 86400) + 3600))) * 10) / 864); - if (beat > 999) beat = 0; + while (beat < 0) { + beat += 1000; + } + beat = beat % 1000; sprintf(tmp_buff, "%03d", beat); /* SAFE */ strcat(return_value->value.str.val, tmp_buff); break;