Skip to main content

implementation of PEP0418 with the "Choosing the clock from a list of constraints" get_clock() and get_clocks() functions

Project description

PEP 418 (https://www.python.org/dev/peps/pep-0418/) generated much discussion.

Most particpants wanted a call to get a high resolution monotonic clock, which many platforms offer, and much of the discussion surrounded what guarrentees Python should offer for the clock it returned.

I was of the opinion that:

  • the many different clocks available have varying features and that the user should be able to inspect them when handed a clock

  • the proposed time.monotonic() et al should be offered as default policies for convenience

  • however, the proposed time.monotonic() call and friends represented policy; the user calling it is handed an arbitrary clock with some guarrentees; the user has no facility to implement policy themselves. Therefore I proposed two calls: get_clock() and get_clocks() for requesting or enumerating clocks with desired features from those available on the platform.

This cs.clockutils package implements get_clock() and get_clocks() and provides example implementations of the “policy” calls such as monotonic().

References:

PEP418

https://www.python.org/dev/peps/pep-0418/

My core two posts in the discussion outlining my proposal

http://www.mail-archive.com/python-dev@python.org/msg66174.html http://www.mail-archive.com/python-dev@python.org/msg66179.html

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cs.clockutils-20150116.2.tar.gz (5.3 kB view details)

Uploaded Source

File details

Details for the file cs.clockutils-20150116.2.tar.gz.

File metadata

File hashes

Hashes for cs.clockutils-20150116.2.tar.gz
Algorithm Hash digest
SHA256 1de260ab0274eef886d22d51832e000547aa6a412735608f1fb7f78c7f318371
MD5 354b8294b90560e1b2cf27bae9df5816
BLAKE2b-256 51be8cc15c263d69b13722572c48dc198de10b06cf6bc4a0ea727ab57bd754c1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page