A lightweight Python library that provides a simple timer
Project description
Pytick
pytick is a lightweight Python library that provides a simple and intuitive timer class for accurate time interval measurements. It allows you to track elapsed time account for waiting periods, and calculate net time. Ideal for benchmarking, performance analysis, and duration tracking in Python applications.
Installation
pip3 install pytick
Use cases
Normal Case:
import time
from pytick import Tick
def func():
time.sleep(1)
if __name__ == "__main__":
Tick.start()
func()
Tick.stop()
print(Tick.get_seconds())
# Output:
1.01297269994393
Get the actual time excluding part of the code
import time
from pytick import Tick
def func():
Tick.wait()
time.sleep(1)
Tick.stop_waiting()
if __name__ == "__main__":
Tick.start()
func()
Tick.stop()
print(Tick.get_active_seconds())
# Output:
1.5600002370774746e-05
Contribution
Feel free to contribute and open a pull request 😄
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pytick-1.0.7.tar.gz
(2.6 kB
view details)
File details
Details for the file pytick-1.0.7.tar.gz
.
File metadata
- Download URL: pytick-1.0.7.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1abd0ad3812c3a32f271888aba487e5d6e098df3e3af9b6eceb8966eff363cbe |
|
MD5 | 31ca9d5a66713acdd92b2fe275653c55 |
|
BLAKE2b-256 | f2ee26e623ae928689faeb2e7bea16dde7cd8930320df1c2e31cab9238892675 |