{"id":17078557,"url":"https://github.com/zariiii9003/win-precise-time","last_synced_at":"2025-04-12T20:34:07.557Z","repository":{"id":39695270,"uuid":"500571762","full_name":"zariiii9003/win-precise-time","owner":"zariiii9003","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-09T18:03:17.000Z","size":39,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T14:17:45.558Z","etag":null,"topics":["getsystemtimepreciseasfiletime","precise","python","sleep"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zariiii9003.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-06T19:44:37.000Z","updated_at":"2024-10-09T18:03:18.000Z","dependencies_parsed_at":"2023-02-01T06:15:19.558Z","dependency_job_id":null,"html_url":"https://github.com/zariiii9003/win-precise-time","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zariiii9003%2Fwin-precise-time","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zariiii9003%2Fwin-precise-time/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zariiii9003%2Fwin-precise-time/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zariiii9003%2Fwin-precise-time/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zariiii9003","download_url":"https://codeload.github.com/zariiii9003/win-precise-time/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248630708,"owners_count":21136489,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["getsystemtimepreciseasfiletime","precise","python","sleep"],"created_at":"2024-10-14T12:22:36.936Z","updated_at":"2025-04-12T20:34:07.501Z","avatar_url":"https://github.com/zariiii9003.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# win-precise-time\n\n[![PyPI - Version](https://img.shields.io/pypi/v/win-precise-time.svg)](https://pypi.org/project/win-precise-time)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/win-precise-time.svg)](https://pypi.org/project/win-precise-time)\n[![Documentation Status](https://readthedocs.org/projects/win-precise-time/badge/?version=latest)](https://win-precise-time.readthedocs.io/en/latest/?badge=latest)\n\nThe documentation is available [here](https://win-precise-time.readthedocs.io/en/latest/).\n\n-----\n\n**Table of Contents**\n\n- [Description](#description)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Test](#test)\n- [Build](#build)\n- [License](#license)\n\n## Description\n\nOn Windows the builtin `time.time()` provides a timestamp with ~15ms resolution. \nThis package provides the function `win_precise_time.time()` to retrieve an accurate timestamp by using\n[GetSystemTimePreciseAsFileTime](https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime).\nThe function is implemented as a C extension so the performance is equal to the builtin `time.perf_counter()` \n(both functions rely on [QueryPerformanceCounter](https://docs.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter)).\n\nThe function `win_precise_time.sleep()` reimplements the more precise `time.sleep()` version of CPython \u003e= 3.11 for older python versions. \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).\n\n## Installation\n\n```console\npip install win-precise-time\n```\n\n## Usage\n\n```python-repl\n\u003e\u003e\u003e import win_precise_time as wpt\n\u003e\u003e\u003e wpt.time()  # retrieve current time\n1654539449.4548845\n\u003e\u003e\u003e wpt.sleep(0.001)  # sleep for 1ms\n```\n\n## Test\n\n```console\npip install tox\ntox\n```\n\n## Build\n\n```console\npip install build\npython -m build .\n```\n\n## License\n\n`win-precise-time` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzariiii9003%2Fwin-precise-time","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzariiii9003%2Fwin-precise-time","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzariiii9003%2Fwin-precise-time/lists"}