8000 Close #14309: Deprecate time.clock() · python/cpython@47620a6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 47620a6

Browse files
committed
Close #14309: Deprecate time.clock()
Use time.perf_counter() or time.process_time() instead.
1 parent ec89539 commit 47620a6

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

Doc/library/time.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ The module defines the following functions and data items:
136136
:c:func:`QueryPerformanceCounter`. The resolution is typically better than one
137137
microsecond.
138138

139+
.. deprecated:: 3.3
140+
The behaviour of this function depends on the platform: use
141+
:func:`perf_counter` or :func:`process_time` instead, depending on your
142+
requirements, to have a well defined behaviour.
143+
139144

140145
.. function:: clock_getres(clk_id)
141146

Doc/whatsnew/3.3.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,9 @@ Deprecated Python modules, functions and methods
11881188
the ANSI code page anymore and to support any filename.
11891189
* :issue:`13988`: The :mod:`xml.etree.cElementTree` module is deprecated. The
11901190
accelerator is used automatically whenever available.
1191+
* The behaviour of :func:`time.clock` depends on the platform: use the new
1192+
:func:`time.perf_counter` or :func:`time.process_time` function instead,
1193+
depending on your requirements, to have a well defined behaviour.
11911194

11921195

11931196
Deprecated functions and types of the C API

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ Core and Builtins
8181
Library
8282
-------
8383

84+
- Issue #14309: Deprecate time.clock(), use time.perf_counter() or
85+
time.process_time() instead.
86+
8487
- Issue #14428: Implement the PEP 418. Add time.get_clock_info(),
8588
time.perf_counter() and time.process_time() functions, and rename
8689
time.steady() to time.monotonic().

0 commit comments

Comments
 (0)
0