@@ -179,6 +179,17 @@ public function removeWriteStream($stream);
179
179
* Similarly, the execution order of timers scheduled to execute at the
180
180
* same time (within its possible accuracy) is not guaranteed.
181
181
*
182
+ * This interface suggests that event loop implementations SHOULD use a
183
+ * monotonic time source if available. Given that a monotonic time source is
184
+ * not available on PHP by default, event loop implementations MAY fall back
185
+ * to using wall-clock time.
186
+ * While this does not affect many common use cases, this is an important
187
+ * distinction for programs that rely on a high time precision or on systems
188
+ * that are subject to discontinuous time adjustments (time jumps).
189
+ * This means that if you schedule a timer to trigger in 30s and then adjust
190
+ * your system time forward by 20s, the timer SHOULD still trigger in 30s.
191
+ * See also [event loop implementations](#loop-implementations) for more details.
192
+ *
182
193
* @param int|float $interval The number of seconds to wait before execution.
183
194
* @param callable $callback The callback to invoke.
184
195
*
@@ -247,7 +258,7 @@ public function addTimer($interval, $callback);
247
258
* same time (within its possible accuracy) is not guaranteed.
248
259
*
249
260
* This interface suggests that event loop implementations SHOULD use a
250
- * monotic time source if available. Given that a monotonic time source is
261
+ * monotonic time source if available. Given that a monotonic time source is
251
262
* not available on PHP by default, event loop implementations MAY fall back
252
263
* to using wall-clock time.
253
264
* While this does not affect many common use cases, this is an important
@@ -257,6 +268,11 @@ public function addTimer($interval, $callback);
257
268
* your system time forward by 20s, the timer SHOULD still trigger in 30s.
258
269
* See also [event loop implementations](#loop-implementations) for more details.
259
270
*
271
+ * Additionally, periodic timers may be subject to timer drift due to
272
+ * re-scheduling after each invocation. As such, it's generally not
273
+ * recommended to rely on this for high precision intervals with millisecond
274
+ * accuracy or below.
275
+ *
260
276
* @param int|float $interval The number of seconds to wait before execution.
261
277
* @param callable $callback The callback to invoke.
262
278
*
0 commit comments