classification
Title: clock_gettime/settime/getres: Add more clock identifiers
Type: enhancement Stage: patch review
Components: Library (Lib) Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ransomedheart08
Priority: normal Keywords: patch

Created on 2012-04-11 22:29 by haypo, last changed 2013-04-25 17:23 by ransomedheart08.

Files
File name Uploaded Description Edit
more_clock_ids.patch haypo, 2012-04-12 20:25 review
more_clock_ids.patch ransomedheart08, 2013-04-25 17:23 Patch with Updated Clock Descriptions review
Messages (7)
msg158084 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2012-04-11 22:29
Python 3.3 supports the following clock identifiers:

 * CLOCK_REALTIME
 * CLOCK_MONOTONIC
 * CLOCK_MONOTONIC_RAW
 * CLOCK_HIGHRES
 * CLOCK_PROCESS_CPUTIME_ID
 * CLOCK_THREAD_CPUTIME_ID

Linux has more clocks:

 * CLOCK_BOOTTIME
 * CLOCK_REALTIME_COARSE
 * CLOCK_MONOTONIC_COARSE
 * CLOCK_BOOTTIME_ALARM
 * CLOCK_REALTIME_ALARM

FreeBSD has more clocks:

 * CLOCK_VIRTUAL
 * CLOCK_UPTIME, CLOCK_UPTIME_FAST, CLOCK_UPTIME_PRECISE
 * CLOCK_MONOTONIC_FAST, CLOCK_MONOTONIC_PRECISE
 * CLOCK_REALTIME_FAST, CLOCK_REALTIME_PRECISE
 * CLOCK_SECOND
 * CLOCK_PROF

CLOCK_BOOTTIME is useful is you would like to handle system suspend for example.
msg158085 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2012-04-11 22:30
Extract of FreeBSD manpage of clock_gettime:

     The clock_id argument can be one of the following values: CLOCK_REALTIME,
     CLOCK_REALTIME_PRECISE, CLOCK_REALTIME_FAST for time that increments as a
     wall clock should; CLOCK_MONOTONIC, CLOCK_MONOTONIC_PRECISE,
     CLOCK_MONOTONIC_FAST which increments in SI seconds; CLOCK_UPTIME,
     CLOCK_UPTIME_PRECISE, CLOCK_UPTIME_FAST which starts at zero when the
     kernel boots and increments monotonically in SI seconds while the machine
     is running; CLOCK_VIRTUAL for time that increments only when the CPU is
     running in user mode on behalf of the calling process; CLOCK_PROF for
     time that increments when the CPU is running in user or kernel mode; or
     CLOCK_SECOND which returns the current second without performing a full
     time counter query, using in-kernel cached value of current second.

     The clock IDs CLOCK_REALTIME_FAST, CLOCK_MONOTONIC_FAST,
     CLOCK_UPTIME_FAST are analogs of corresponding IDs without _FAST suffix
     but do not perform a full time counter query, so their accuracy is one
     timer tick.  Similarly, CLOCK_REALTIME_PRECISE, CLOCK_MONOTONIC_PRECISE,
     CLOCK_UPTIME_PRECISE are used to get the most exact value as possible, at
     the expense of execution time.
msg158167 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2012-04-12 20:25
more_clock_ids.patch: add more clock identifiers. Don't add the following clocks: CLOCK_BOOTTIME_ALARM, CLOCK_REALTIME_ALARM, CLOCK_UPTIME_FAST, CLOCK_UPTIME_PRECISE, CLOCK_MONOTONIC_PRECISE, CLOCK_REALTIME_PRECISE.

The documentation should be improved :-/
msg158227 - (view) Author: Jim Jewett (Jim.Jewett) Date: 2012-04-13 19:15
Any particular reason not to add those?
msg158237 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2012-04-13 21:41
> Any particular reason not to add those?

I didn't find yet documentation of: CLOCK_BOOTTIME_ALARM, CLOCK_REALTIME_ALARM

For CLOCK_UPTIME_PRECISE, CLOCK_MONOTONIC_PRECISE, CLOCK_REALTIME_PRECISE: I don't know if there are useful. Are they different than the clocks without _PRECISE suffix?

For CLOCK_UPTIME_FAST, it's just that I forgot to add it :-)
msg187260 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2013-04-18 15:25
If nothing else the patch will need updating to show versionadded as 3.4 instead of 3.3.
msg187793 - (view) Author: Kirsten Stevenson (ransomedheart08) Date: 2013-04-25 17:23
I have added descriptions for CLOCK_BOOTTIME_ALARM and CLOCK_REALTIME_ALARM to the patch.
History
Date User Action Args
2013-04-25 17:23:09ransomedheart08setfiles: + more_clock_ids.patch
versions: - Python 3.4
nosy: + ransomedheart08, - haypo, BreamoreBoy, Jim.Jewett

messages: + msg187793
2013-04-18 15:25:31BreamoreBoysetnosy: + BreamoreBoy

messages: + msg187260
versions: + Python 3.4, - Python 3.3
2012-05-06 21:26:32ezio.melottisetstage: patch review
2012-04-13 21:41:57hayposetmessages: + msg158237
2012-04-13 19:15:49Jim.Jewettsetnosy: + Jim.Jewett
messages: + msg158227
2012-04-12 20:25:57hayposetfiles: + more_clock_ids.patch
keywords: + patch
messages: + msg158167
2012-04-12 00:03:23r.david.murraysettype: enhancement
2012-04-11 22:30:46hayposetmessages: + msg158085
2012-04-11 22:29:17haypocreate