Skip to main content

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.

Usage

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

Tests

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.

Change Log

0.0.4 - 2019-03-25

Fixed

  • [#1] import from ctypes fails

0.0.3 - 2019-03-23

Fixed

  • corrected the trove classifier for the package’s license

0.0.2 - 2019-03-23

Changed

  • setup.cfg now enables universal wheels

0.0.1 - 2019-03-23

Initial release.

Release files for backports.time-perf-counter 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for backports.time-perf-counter 0.0.4
File Size Uploaded
backports.time_perf_counter-0.0.4.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for backports.time-perf-counter 0.0.4
File Interpreter ABI Platform
backports.time_perf_counter-0.0.4-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 9.3 kB

Release files / backports.time_perf_counter-0.0.4.tar.gz

Download URL backports.time_perf_counter-0.0.4.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6be205f204e470e59b1553965d1120395c1a2ccf11f6ec4fa6f0c5e1d0cc9328
BLAKE2b-256 checksum
How to use checksums
555d03e31063e1374de1c5abdc19ba6c649792b5f9612d62c117b9a3e5bc5b1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.9

Release files / backports.time_perf_counter-0.0.4-py2.py3-none-any.whl

Download URL backports.time_perf_counter-0.0.4-py2.py3-none-any.whl
Size 4.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
d44ae51a4c38f4cf3c045f7374a80d49eaf7eeea8308ae03aeaa3be9560638ce
BLAKE2b-256 checksum
How to use checksums
aacbca66974161c1cb4da609a7483d38efac1acf6710dca118f968f87b84daf1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.9

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page