time.perf_counter() for Python < 3.3
This package contains a backport of the time.perf_counter() function introduced in Python 3.3. This package is intended for use with Python versions older than 3.3 but will work just fine under newer Pythons. When used with Python 3.3 and newer, the main module simply exports time.perf_counter().
The backported functionality is based on the pseudocode in PEP 418 that describes how time.perf_counter() could be implemented. When used with Python versions older than 3.3, the exported perf_counter() function relies on the monotonic() function provided by the monotonic package.
I recommend not introducing a dependency on this package under Pythons which provide time.perf_counter(). In your package’s setup.py:
import setuptools setuptools.setup( install_requires=[ 'backports.time_perf_counter; python_version < "3.3"' ] )
In the module that relies on perf_counter():
try: # Python >= 3.3 from time import perf_counter except ImportError: # Python < 3.3 from backports.time_perf_counter import perf_counter
This package’s tests use the builtin unittest and can be run without first installing the package:
python setup.py test
The test cases are based on tests from the Python standard library’s time module that exercise time.perf_counter(). There are an admittedly small number of tests; pull requests with more tests are welcome.
0.0.4 - 2019-03-25
- [#1] import from ctypes fails
0.0.3 - 2019-03-23
- corrected the trove classifier for the package’s license
0.0.2 - 2019-03-23
- setup.cfg now enables universal wheels
0.0.1 - 2019-03-23
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size backports.time_perf_counter-0.0.4-py2.py3-none-any.whl (4.7 kB)||File type Wheel||Python version py2.py3||Upload date||Hashes View hashes|
|Filename, size backports.time_perf_counter-0.0.4.tar.gz (4.6 kB)||File type Source||Python version None||Upload date||Hashes View hashes|
Hashes for backports.time_perf_counter-0.0.4-py2.py3-none-any.whl
Hashes for backports.time_perf_counter-0.0.4.tar.gz