]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-103417: Fix the scheduler example (GH-111497) (GH-115909)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 25 Feb 2024 12:04:47 +0000 (13:04 +0100)
committerGitHub <noreply@github.com>
Sun, 25 Feb 2024 12:04:47 +0000 (14:04 +0200)
Arguments to enterabs() are specified as Unix time.
If the scheduler use the time.monotonic timer, the code will take
decades to complete.
(cherry picked from commit cb287d342139509e03a2dbe5ea2608627fd3a350)

Co-authored-by: mauricelambert <50479118+mauricelambert@users.noreply.github.com>
Doc/library/sched.rst

index 01bac5afd0b9b38cf6ad698c55f8a28922199248..4c980dd97f9394f1a52f5e8f29afb80aed3b7b98 100644 (file)
@@ -36,7 +36,7 @@ scheduler:
 Example::
 
    >>> import sched, time
-   >>> s = sched.scheduler(time.monotonic, time.sleep)
+   >>> s = sched.scheduler(time.time, time.sleep)
    >>> def print_time(a='default'):
    ...     print("From print_time", time.time(), a)
    ...