win-precise-time


Namewin-precise-time JSON
Version 1.4.2 PyPI version JSON
download
home_page
Summary
upload_time2023-10-08 17:08:18
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMIT
keywords windows time sleep getsystemtimepreciseasfiletime setwaitabletimerex create_waitable_timer_high_resolution
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # win-precise-time

[![PyPI - Version](https://img.shields.io/pypi/v/win-precise-time.svg)](https://pypi.org/project/win-precise-time)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/win-precise-time.svg)](https://pypi.org/project/win-precise-time)
[![Documentation Status](https://readthedocs.org/projects/win-precise-time/badge/?version=latest)](https://win-precise-time.readthedocs.io/en/latest/?badge=latest)

The documentation is available [here](https://win-precise-time.readthedocs.io/en/latest/).

-----

**Table of Contents**

- [Description](#description)
- [Installation](#installation)
- [Usage](#usage)
- [Test](#test)
- [Build](#build)
- [License](#license)

## Description

On Windows the builtin `time.time()` provides a timestamp with ~15ms resolution. 
This package provides the function `win_precise_time.time()` to retrieve an accurate timestamp by using
[GetSystemTimePreciseAsFileTime](https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime).
The function is implemented as a C extension so the performance is equal to the builtin `time.perf_counter()` 
(both functions rely on [QueryPerformanceCounter](https://docs.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter)).

The function `win_precise_time.sleep()` reimplements the more precise `time.sleep()` version of CPython >= 3.11 for older python versions. 
This enables sub-millisecond sleep precision without increasing the Windows timer resolution via [timeBeginPeriod](https://docs.microsoft.com/en-us/windows/win32/api/timeapi/nf-timeapi-timebeginperiod).

## Installation

```console
pip install win-precise-time
```

## Usage

```python-repl
>>> import win_precise_time as wpt
>>> wpt.time()  # retrieve current time
1654539449.4548845
>>> wpt.sleep(0.001)  # sleep for 1ms
```

## Test

```console
pip install tox
tox
```

## Build

```console
pip install build
python -m build .
```

## License

`win-precise-time` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "win-precise-time",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "Windows,time,sleep,GetSystemTimePreciseAsFileTime,SetWaitableTimerEx,CREATE_WAITABLE_TIMER_HIGH_RESOLUTION",
    "author": "",
    "author_email": "Artur Drogunow <artur.drogunow@zf.com>",
    "download_url": "https://files.pythonhosted.org/packages/9e/b0/21547e16a47206ccdd15769bf65e143ade1ffae67f0881c855f76e44e9fa/win-precise-time-1.4.2.tar.gz",
    "platform": null,
    "description": "# win-precise-time\r\n\r\n[![PyPI - Version](https://img.shields.io/pypi/v/win-precise-time.svg)](https://pypi.org/project/win-precise-time)\r\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/win-precise-time.svg)](https://pypi.org/project/win-precise-time)\r\n[![Documentation Status](https://readthedocs.org/projects/win-precise-time/badge/?version=latest)](https://win-precise-time.readthedocs.io/en/latest/?badge=latest)\r\n\r\nThe documentation is available [here](https://win-precise-time.readthedocs.io/en/latest/).\r\n\r\n-----\r\n\r\n**Table of Contents**\r\n\r\n- [Description](#description)\r\n- [Installation](#installation)\r\n- [Usage](#usage)\r\n- [Test](#test)\r\n- [Build](#build)\r\n- [License](#license)\r\n\r\n## Description\r\n\r\nOn Windows the builtin `time.time()` provides a timestamp with ~15ms resolution. \r\nThis package provides the function `win_precise_time.time()` to retrieve an accurate timestamp by using\r\n[GetSystemTimePreciseAsFileTime](https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime).\r\nThe function is implemented as a C extension so the performance is equal to the builtin `time.perf_counter()` \r\n(both functions rely on [QueryPerformanceCounter](https://docs.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter)).\r\n\r\nThe function `win_precise_time.sleep()` reimplements the more precise `time.sleep()` version of CPython >= 3.11 for older python versions. \r\nThis enables sub-millisecond sleep precision without increasing the Windows timer resolution via [timeBeginPeriod](https://docs.microsoft.com/en-us/windows/win32/api/timeapi/nf-timeapi-timebeginperiod).\r\n\r\n## Installation\r\n\r\n```console\r\npip install win-precise-time\r\n```\r\n\r\n## Usage\r\n\r\n```python-repl\r\n>>> import win_precise_time as wpt\r\n>>> wpt.time()  # retrieve current time\r\n1654539449.4548845\r\n>>> wpt.sleep(0.001)  # sleep for 1ms\r\n```\r\n\r\n## Test\r\n\r\n```console\r\npip install tox\r\ntox\r\n```\r\n\r\n## Build\r\n\r\n```console\r\npip install build\r\npython -m build .\r\n```\r\n\r\n## License\r\n\r\n`win-precise-time` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "",
    "version": "1.4.2",
    "project_urls": {
        "Documentation": "https://win-precise-time.readthedocs.io/en/latest/",
        "Homepage": "https://github.com/zariiii9003/win-precise-time",
        "Issues": "https://github.com/zariiii9003/win-precise-time/issues",
        "Source": "https://github.com/zariiii9003/win-precise-time"
    },
    "split_keywords": [
        "windows",
        "time",
        "sleep",
        "getsystemtimepreciseasfiletime",
        "setwaitabletimerex",
        "create_waitable_timer_high_resolution"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f78bba6bdef9284fd75f816205bf9a198a2cf7b22459ff401174143ade5afe08",
                "md5": "f681cdeb32a5d665b11634da809467f4",
                "sha256": "7fa13a2247c2ef41cd5e9b930f40716eacc7fc1f079ea72853bd5613fe087a1a"
            },
            "downloads": -1,
            "filename": "win_precise_time-1.4.2-cp310-cp310-win32.whl",
            "has_sig": false,
            "md5_digest": "f681cdeb32a5d665b11634da809467f4",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.7",
            "size": 14700,
            "upload_time": "2023-10-08T17:08:03",
            "upload_time_iso_8601": "2023-10-08T17:08:03.987935Z",
            "url": "https://files.pythonhosted.org/packages/f7/8b/ba6bdef9284fd75f816205bf9a198a2cf7b22459ff401174143ade5afe08/win_precise_time-1.4.2-cp310-cp310-win32.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "257f5087d16a720b6833cb631b4b6f912b0ff433377227ecbbc494453951cbb5",
                "md5": "3c304714899d82a089d1da38d72564f4",
                "sha256": "bb8e44b0fc35fde268e8a781cdcd9f47d47abcd8089465d2d1d1063976411c8e"
            },
            "downloads": -1,
            "filename": "win_precise_time-1.4.2-cp310-cp310-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "3c304714899d82a089d1da38d72564f4",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.7",
            "size": 14913,
            "upload_time": "2023-10-08T17:08:05",
            "upload_time_iso_8601": "2023-10-08T17:08:05.519674Z",
            "url": "https://files.pythonhosted.org/packages/25/7f/5087d16a720b6833cb631b4b6f912b0ff433377227ecbbc494453951cbb5/win_precise_time-1.4.2-cp310-cp310-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bbd6a48717649fea2d7a6679db86dae9ae4b12078c7a48aa89a8f14a360f29d0",
                "md5": "f025f6753733e6a8778083cad1403c9f",
                "sha256": "59272655ad6f36910d0b585969402386fa627fca3be24acc9a21be1d550e5db8"
            },
            "downloads": -1,
            "filename": "win_precise_time-1.4.2-cp311-cp311-win32.whl",
            "has_sig": false,
            "md5_digest": "f025f6753733e6a8778083cad1403c9f",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.7",
            "size": 14703,
            "upload_time": "2023-10-08T17:08:06",
            "upload_time_iso_8601": "2023-10-08T17:08:06.945265Z",
            "url": "https://files.pythonhosted.org/packages/bb/d6/a48717649fea2d7a6679db86dae9ae4b12078c7a48aa89a8f14a360f29d0/win_precise_time-1.4.2-cp311-cp311-win32.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f99c46d69220d468c82ca2044284c5a8089705c5eb66be416abcbba156365a14",
                "md5": "440ad8087e2648baa055aedff6d96b70",
                "sha256": "0897bb055f19f3b4336e2ba6bee0115ac20fd7ec615a6d736632e2df77f8851a"
            },
            "downloads": -1,
            "filename": "win_precise_time-1.4.2-cp311-cp311-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "440ad8087e2648baa055aedff6d96b70",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.7",
            "size": 14912,
            "upload_time": "2023-10-08T17:08:07",
            "upload_time_iso_8601": "2023-10-08T17:08:07.896830Z",
            "url": "https://files.pythonhosted.org/packages/f9/9c/46d69220d468c82ca2044284c5a8089705c5eb66be416abcbba156365a14/win_precise_time-1.4.2-cp311-cp311-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2e9655a14b5c0e90439951f4a72672223bba81a5f882033c5850f8a6c7f4308b",
                "md5": "58deac667990997a33cab96d203eb1a0",
                "sha256": "0210dcea88a520c91de1708ae4c881e3c0ddc956daa08b9eabf2b7c35f3109f5"
            },
            "downloads": -1,
            "filename": "win_precise_time-1.4.2-cp312-cp312-win32.whl",
            "has_sig": false,
            "md5_digest": "58deac667990997a33cab96d203eb1a0",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.7",
            "size": 14694,
            "upload_time": "2023-10-08T17:08:09",
            "upload_time_iso_8601": "2023-10-08T17:08:09.275276Z",
            "url": "https://files.pythonhosted.org/packages/2e/96/55a14b5c0e90439951f4a72672223bba81a5f882033c5850f8a6c7f4308b/win_precise_time-1.4.2-cp312-cp312-win32.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "17197ea9a22a69fc23d5ca02e8edf65e4a335a210497794af1af0ef8fda91fa0",
                "md5": "04731dcf7811199485c2f3ebc4828c35",
                "sha256": "85670f77cc8accd8f1e6d05073999f77561c23012a9ee988cbd44bb7ce655062"
            },
            "downloads": -1,
            "filename": "win_precise_time-1.4.2-cp312-cp312-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "04731dcf7811199485c2f3ebc4828c35",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.7",
            "size": 14913,
            "upload_time": "2023-10-08T17:08:10",
            "upload_time_iso_8601": "2023-10-08T17:08:10.677878Z",
            "url": "https://files.pythonhosted.org/packages/17/19/7ea9a22a69fc23d5ca02e8edf65e4a335a210497794af1af0ef8fda91fa0/win_precise_time-1.4.2-cp312-cp312-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ef4446111dd608cfac2f6433b98632495f630af5a7049b809cb7eb48e58d82bb",
                "md5": "79c4e583cb8edc657de154dc6d359d3f",
                "sha256": "3e23693201a0fc6ca39f016871e2581e20c91123734bd48a69259f8c8724eedb"
            },
            "downloads": -1,
            "filename": "win_precise_time-1.4.2-cp37-cp37m-win32.whl",
            "has_sig": false,
            "md5_digest": "79c4e583cb8edc657de154dc6d359d3f",
            "packagetype": "bdist_wheel",
            "python_version": "cp37",
            "requires_python": ">=3.7",
            "size": 14721,
            "upload_time": "2023-10-08T17:08:11",
            "upload_time_iso_8601": "2023-10-08T17:08:11.548925Z",
            "url": "https://files.pythonhosted.org/packages/ef/44/46111dd608cfac2f6433b98632495f630af5a7049b809cb7eb48e58d82bb/win_precise_time-1.4.2-cp37-cp37m-win32.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c44b62a120dae678446d33a1a0e888df19d89c95eee1c8df4ec8d45bd93199b3",
                "md5": "c6ff2eb80a81637ddaa53e49d0452e8e",
                "sha256": "07ef644d1bb7705039bc54abfe4b45e99e8dc326dfd1dad5831dab19670508cb"
            },
            "downloads": -1,
            "filename": "win_precise_time-1.4.2-cp37-cp37m-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "c6ff2eb80a81637ddaa53e49d0452e8e",
            "packagetype": "bdist_wheel",
            "python_version": "cp37",
            "requires_python": ">=3.7",
            "size": 14954,
            "upload_time": "2023-10-08T17:08:12",
            "upload_time_iso_8601": "2023-10-08T17:08:12.466193Z",
            "url": "https://files.pythonhosted.org/packages/c4/4b/62a120dae678446d33a1a0e888df19d89c95eee1c8df4ec8d45bd93199b3/win_precise_time-1.4.2-cp37-cp37m-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d32b2b0d6c0b92cb755ac4f5b64bc8d3dbd2dc5e39b711cded12f367be43afcc",
                "md5": "31c8dff117f618f0f10c85b92287ae01",
                "sha256": "0a953b00772f205602fa712ef68387b8fb213a30b267ae310aa56bf17605e11b"
            },
            "downloads": -1,
            "filename": "win_precise_time-1.4.2-cp38-cp38-win32.whl",
            "has_sig": false,
            "md5_digest": "31c8dff117f618f0f10c85b92287ae01",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.7",
            "size": 14706,
            "upload_time": "2023-10-08T17:08:13",
            "upload_time_iso_8601": "2023-10-08T17:08:13.657960Z",
            "url": "https://files.pythonhosted.org/packages/d3/2b/2b0d6c0b92cb755ac4f5b64bc8d3dbd2dc5e39b711cded12f367be43afcc/win_precise_time-1.4.2-cp38-cp38-win32.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e533f582f0a130f3362f2d0dd0d98f69b0f4f95a079f2390161b1773102fcc06",
                "md5": "0f93c0274253f546107247d8b8891a7d",
                "sha256": "b5d83420925beca302b386b19c3e7414ada84b47b42f0680207f1508917a1731"
            },
            "downloads": -1,
            "filename": "win_precise_time-1.4.2-cp38-cp38-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "0f93c0274253f546107247d8b8891a7d",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.7",
            "size": 14931,
            "upload_time": "2023-10-08T17:08:15",
            "upload_time_iso_8601": "2023-10-08T17:08:15.120143Z",
            "url": "https://files.pythonhosted.org/packages/e5/33/f582f0a130f3362f2d0dd0d98f69b0f4f95a079f2390161b1773102fcc06/win_precise_time-1.4.2-cp38-cp38-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "342a9f4b13ffe4a876f12ad7d7321a928f910865ff0c50aa91d3725ac1181287",
                "md5": "38af8e601552d0bd140b84146a67ee8c",
                "sha256": "50d11a6ff92e1be96a8d4bee99ff6dc07a0ea0e2a392b0956bb2192e334f41ba"
            },
            "downloads": -1,
            "filename": "win_precise_time-1.4.2-cp39-cp39-win32.whl",
            "has_sig": false,
            "md5_digest": "38af8e601552d0bd140b84146a67ee8c",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.7",
            "size": 14709,
            "upload_time": "2023-10-08T17:08:16",
            "upload_time_iso_8601": "2023-10-08T17:08:16.135752Z",
            "url": "https://files.pythonhosted.org/packages/34/2a/9f4b13ffe4a876f12ad7d7321a928f910865ff0c50aa91d3725ac1181287/win_precise_time-1.4.2-cp39-cp39-win32.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "17cf4237d55123e107f32ba1417d00f7b0ea0e894bb68e495678db52bdccab5b",
                "md5": "d4d9ab005ffe711ccb2d61ebe4761d79",
                "sha256": "3f510fa92d9c39ea533c983e1d62c7bc66fdf0a3e3c3bdda48d4ebb634ff7034"
            },
            "downloads": -1,
            "filename": "win_precise_time-1.4.2-cp39-cp39-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "d4d9ab005ffe711ccb2d61ebe4761d79",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.7",
            "size": 14932,
            "upload_time": "2023-10-08T17:08:17",
            "upload_time_iso_8601": "2023-10-08T17:08:17.588919Z",
            "url": "https://files.pythonhosted.org/packages/17/cf/4237d55123e107f32ba1417d00f7b0ea0e894bb68e495678db52bdccab5b/win_precise_time-1.4.2-cp39-cp39-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9eb021547e16a47206ccdd15769bf65e143ade1ffae67f0881c855f76e44e9fa",
                "md5": "f1d257822106991877d2bc2f2edc2269",
                "sha256": "89274785cbc5f2997e01675206da3203835a442c60fd97798415c6b3c179c0b9"
            },
            "downloads": -1,
            "filename": "win-precise-time-1.4.2.tar.gz",
            "has_sig": false,
            "md5_digest": "f1d257822106991877d2bc2f2edc2269",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 7982,
            "upload_time": "2023-10-08T17:08:18",
            "upload_time_iso_8601": "2023-10-08T17:08:18.618034Z",
            "url": "https://files.pythonhosted.org/packages/9e/b0/21547e16a47206ccdd15769bf65e143ade1ffae67f0881c855f76e44e9fa/win-precise-time-1.4.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-08 17:08:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zariiii9003",
    "github_project": "win-precise-time",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "win-precise-time"
}
        
Elapsed time: 0.12924s