# [PATCH] time/001.phpt fix

- Thread: https://externals.io/message/11524
- Original archive: https://news-web.php.net/php.internals/11524
- Started by Joe Orton on 2004-07-23T21:17:15+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #11524 — Joe Orton — 2004-07-23T21:17:15+00:00

URL: https://externals.io/message/11524#11524

[resend]

There's no reason why `gettimeofday()` shouldn''t return the same time in
successive calls; this test fails spuriously on Linux/x86_64 (which has
a particularly fast `gettimeofday()` implementation).

--- ext/standard/tests/time/001.phpt	23 May 2003 20:56:33 -0000	1.4.2.2
+++ ext/standard/tests/time/001.phpt	16 Jul 2004 12:50:13 -0000
@@ -17,7 +17,7 @@
 
 for ($i=1;$i<=100000;$i++) {
 	list($micro,$time)=explode(" ",microtime());
-	if ($time > $last_t || ($time == $last_t && $micro > $last_m)) {
+	if ($time > $last_t || ($time == $last_t && $micro >= $last_m)) {
 		$passed++;
 	} else if ($failed++ <=10) {
 		$result .= sprintf('%06d', $i).": $time $micro < $last_t $last_m\n";

---

## #11527 — Andi Gutmans — 2004-07-23T21:51:19+00:00

URL: https://externals.io/message/11524#11527 · In reply to: #11524

Yep you're right. It can definitely return the same time twice in a row. 
I'll commit this.

At 10:17 PM 7/23/2004 +0100, Joe Orton wrote:
>[resend]
>
>There's no reason why `gettimeofday()` shouldn''t return the same time in
>successive calls; this test fails spuriously on Linux/x86_64 (which has
>a particularly fast `gettimeofday()` implementation).
>
>--- ext/standard/tests/time/001.phpt    23 May 2003 20:56:33 
>-0000      1.4.2.2
>+++ ext/standard/tests/time/001.phpt    16 Jul 2004 12:50:13 -0000
>@@ -17,7 +17,7 @@
>
>  for ($i=1;$i<=100000;$i++) {
>         list($micro,$time)=explode(" ",microtime());
>-       if ($time > $last_t || ($time == $last_t && $micro > $last_m)) {
>+       if ($time > $last_t || ($time == $last_t && $micro >= $last_m)) {
>                 $passed++;
>         } else if ($failed++ <=10) {
>                 $result .= sprintf('%06d', $i).": $time $micro < $last_t 
> $last_m\n";
