summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-10-25 11:06:09 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-10-25 11:06:09 (GMT)
commite0be4232971edca23438cc3d79761141f2de124f (patch)
tree7149c8f35615c64e122de1478900f5e8cb516c04 /Doc
parent92b958420e90b5e98c795db75693310cb9317f95 (diff)
downloadcpython-e0be4232971edca23438cc3d79761141f2de124f.zip
cpython-e0be4232971edca23438cc3d79761141f2de124f.tar.gz
cpython-e0be4232971edca23438cc3d79761141f2de124f.tar.bz2
Close #10278: Add clock_getres(), clock_gettime() and CLOCK_xxx constants to
the time module. time.clock_gettime(time.CLOCK_MONOTONIC) provides a monotonic clock
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/time.rst48
-rw-r--r--Doc/whatsnew/3.3.rst10
2 files changed, 58 insertions, 0 deletions
diff --git a/Doc/library/time.rst b/Doc/library/time.rst
index d95d83c..668651a 100644
--- a/Doc/library/time.rst
+++ b/Doc/library/time.rst
@@ -136,6 +136,54 @@ The module defines the following functions and data items:
microsecond.
+.. function:: clock_getres(clk_id)
+
+ Return the resolution (precision) of the specified clock *clk_id*.
+
+ .. versionadded:: 3.3
+
+.. function:: clock_gettime(clk_id)
+
+ Return the time of the specified clock *clk_id*.
+
+ .. versionadded:: 3.3
+
+.. data:: CLOCK_REALTIME
+
+ System-wide real-time clock. Setting this clock requires appropriate
+ privileges.
+
+ .. versionadded:: 3.3
+
+.. data:: CLOCK_MONOTONIC
+
+ Clock that cannot be set and represents monotonic time since some
+ unspecified starting point.
+
+ .. versionadded:: 3.3
+
+.. data:: CLOCK_MONOTONIC_RAW
+
+ Similar to :data:`CLOCK_MONOTONIC`, but provides access to a raw
+ hardware-based time that is not subject to NTP adjustments.
+
+ Availability: Linux 2.6.28 or later.
+
+ .. versionadded:: 3.3
+
+.. data:: CLOCK_PROCESS_CPUTIME_ID
+
+ High-resolution per-process timer from the CPU.
+
+ .. versionadded:: 3.3
+
+.. data:: CLOCK_THREAD_CPUTIME_ID
+
+ Thread-specific CPU-time clock.
+
+ .. versionadded:: 3.3
+
+
.. function:: ctime([secs])
Convert a time expressed in seconds since the epoch to a string representing
diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst
index 6a378a9..6ae8315 100644
--- a/Doc/whatsnew/3.3.rst
+++ b/Doc/whatsnew/3.3.rst
@@ -272,6 +272,16 @@ New module: :mod:`faulthandler`.
* :envvar:`PYTHONFAULTHANDLER`
* :option:`-X` ``faulthandler``
+time
+----
+
+* The :mod:`time` module has new :func:`~time.clock_getres` and
+ :func:`~time.clock_gettime` functions and ``CLOCK_xxx`` constants.
+ :func:`~time.clock_gettime` can be used with :data:`time.CLOCK_MONOTONIC` to
+ get a monotonic clock.
+
+ (Contributed by Victor Stinner in :issue:`10278`)
+
ftplib
------