summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Croft <david@php.net>2001-01-10 06:48:06 +0000
committerDavid Croft <david@php.net>2001-01-10 06:48:06 +0000
commit2b3d9d7ec454ea8d573158bc90970c58000718f6 (patch)
tree6d8f0d49ee2be325b24a82eb934707bda19f4a9a
parent0afe88cbc6818f9d00e96294149270d0c55547a0 (diff)
downloadphp-git-2b3d9d7ec454ea8d573158bc90970c58000718f6.tar.gz
fixed swatch internet time (bugs#8242,7106)
-rw-r--r--ext/standard/datetime.c5
1 files changed, 4 insertions, 1 deletions
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;