10000 Documentation for millisecond timer accuracy · reactphp/event-loop@a3d4bdd · GitHub
[go: up one dir, main page]

Skip to content

Commit a3d4bdd

Browse files
committed
Documentation for millisecond timer accuracy
1 parent b94bc8e commit a3d4bdd

File tree

2 files changed

+40
-8
lines changed

2 files changed

+40
-8
lines changed

README.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,16 @@ function hello($name, LoopInterface $loop)
281281
hello('Tester', $loop);
282282
```
283283

284-
The execution order of timers scheduled to execute at the same time is
285-
not guaranteed.
284+
This interface does not enforce any particular timer resolution, so
285+
special care may have to be taken if you rely on very high precision with
286+
millisecond accuracy or below. Event loop implementations SHOULD work on
287+
a best effort basis and SHOULD provide at least millisecond accuracy
288+
unless otherwise noted. Many existing event loop implementations are
289+
known to provide microsecond accuracy, but it's generally not recommended
290+
to rely on this high precision.
291+
292+
Similarly, the execution order of timers scheduled to execute at the
293+
same time (within its possible accuracy) is not guaranteed.
286294

287295
This interface suggests that event loop implementations SHOULD use a
288296
monotic time source if available. Given that a monotonic time source is
@@ -346,8 +354,16 @@ function hello($name, LoopInterface $loop)
346354
hello('Tester', $loop);
347355
```
348356

349-
The execution order of timers scheduled to execute at the same time is
350-
not guaranteed.
357+
This interface does not enforce any particular timer resolution, so
358+
special care may have to be taken if you rely on very high precision with
359+
millisecond accuracy or below. Event loop implementations SHOULD work on
360+
a best effort basis and SHOULD provide at least millisecond accuracy
361+
unless otherwise noted. Many existing event loop implementations are
362+
known to provide microsecond accuracy, but it's generally not recommended
363+
to rely on this high precision.
364+
365+
Similarly, the execution order of timers scheduled to execute at the
366+
same time (within its possible accuracy) is not guaranteed.
351367

352368
#### cancelTimer()
353369

src/LoopInterface.php

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,16 @@ public function removeWriteStream($stream);
168168
* hello('Tester', $loop);
169169
* ```
170170
*
171-
* The execution order of timers scheduled to execute at the same time is
172-
* not guaranteed.
171+
* This interface does not enforce any particular timer resolution, so
172+
* special care may have to be taken if you rely on very high precision with
173+
* millisecond accuracy or below. Event loop implementations SHOULD work on
174+
* a best effort basis and SHOULD provide at least millisecond accuracy
175+
* unless otherwise noted. Many existing event loop implementations are
176+
* known to provide microsecond accuracy, but it's generally not recommended
177+
* to rely on this high precision.
178+
*
179+
* Similarly, the execution order of timers scheduled to execute at the
180+
* same time (within its possible accuracy) is not guaranteed.
173181
*
174182
* @param int|float $interval The number of seconds to wait before execution.
175183
* @param callable $callback The callback to invoke.
@@ -227,8 +235,16 @@ public function addTimer($interval, $callback);
227235
* hello('Tester', $loop);
228236
* ```
229237
*
230-
* The execution order of timers scheduled to execute at the same time is
231-
* not guaranteed.
238+
* This interface does not enforce any particular timer resolution, so
239+
* special care may have to be taken if you rely on very high precision with
240+
* millisecond accuracy or below. Event loop implementations SHOULD work on
241+
* a best effort basis and SHOULD provide at least millisecond accuracy
242+
* unless otherwise noted. Many existing event loop implementations are
243+
* known to provide microsecond accuracy, but it's generally not recommended
244+
* to rely on this high precision.
245+
*
246+
* Similarly, the execution order of timers scheduled to execute at the
247+
* same time (within its possible accuracy) is not guaranteed.
232248
*
233249
* This interface suggests that event loop implementations SHOULD use a
234250
* monotic time source if available. Given that a monotonic time source is

0 commit comments

Comments
 (0)
0