]> granicus.if.org Git - php/commitdiff
fixed swatch internet time (bugs#8242,7106)
authorDavid Croft <david@php.net>
Wed, 10 Jan 2001 06:48:06 +0000 (06:48 +0000)
committerDavid Croft <david@php.net>
Wed, 10 Jan 2001 06:48:06 +0000 (06:48 +0000)
ext/standard/datetime.c

index 159804d0343001c7c55b96317b61bfca417d8420..609df5d55843c4d80c35e051d302b05e67a0ed70 100644 (file)
@@ -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;