[Python-Dev] cpython: Issue #10278: Add an optional strict argument to time.steady(), False by default (original) (raw)
Georg Brandl g.brandl at gmx.net
Sat Mar 17 23:04:46 CET 2012
- Previous message: [Python-Dev] cpython: Issue #10278: Add an optional strict argument to time.steady(), False by default
- Next message: [Python-Dev] cpython: Issue #10278: Add an optional strict argument to time.steady(), False by default
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 03/17/2012 09:47 PM, Michael Foord wrote:
On 17 Mar 2012, at 08:49, Georg Brandl wrote:
On 03/15/2012 01:17 AM, victor.stinner wrote: http://hg.python.org/cpython/rev/27441e0d6a75 changeset: 75672:27441e0d6a75 user: Victor Stinner <victor.stinner at gmail.com> date: Thu Mar 15 01:17:09 2012 +0100 summary: Issue #10278: Add an optional strict argument to time.steady(), False by default
files: Doc/library/time.rst | 7 +++- Lib/test/testtime.py | 10 +++++ Modules/timemodule.c | 58 +++++++++++++++++++++--------- 3 files changed, 57 insertions(+), 18 deletions(-)
diff --git a/Doc/library/time.rst b/Doc/library/time.rst --- a/Doc/library/time.rst +++ b/Doc/library/time.rst @@ -226,7 +226,7 @@ The earliest date for which it can generate a time is platform-dependent. -.. function:: steady() +.. function:: steady(strict=False) .. index:: single: benchmarking @@ -236,6 +236,11 @@ adjusted. The reference point of the returned value is undefined so only the difference of consecutive calls is valid. + If available, a monotonic clock is used. By default, if strict is False, + the function falls back to another clock if the monotonic clock failed or is + not available. If strict is True, raise an :exc:
OSError
on error or + :exc:NotImplementedError
if no monotonic clock is available. This is not clear to me. Why wouldn't it raise OSError on error even with strict=False? Please clarify which exception is raised in which case. It seems clear to me. It doesn't raise exceptions when strict=False because it falls back to a non-monotonic clock. If strict is True and a non-monotonic clock is not available it raises OSError or NotImplementedError.
So errors are ignored when strict is false?
Georg
- Previous message: [Python-Dev] cpython: Issue #10278: Add an optional strict argument to time.steady(), False by default
- Next message: [Python-Dev] cpython: Issue #10278: Add an optional strict argument to time.steady(), False by default
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]