larztime
Human-friendly time — durations and relative time, in words people can read.
"93784 seconds" means nothing to a person; "1 day, 2 hours, 3 minutes" does. larztime turns durations into readable words (and back), formats clocks, and says things like "3 minutes ago" — all from plain numbers you pass in, so it's fully deterministic and testable (it never reads the system clock for you). Zero dependencies.
Install
pip install larztime
Use
from larztime import humanize, short, clock, parse_duration, ago
humanize(93784) # '1 day, 2 hours, 3 minutes, 4 seconds'
short(93784) # '1d 2h 3m 4s'
clock(3725) # '01:02:05'
parse_duration("1h30m") # 5400
ago(100, 400) # '5 minutes ago' (then=100, now=400)
Learn to code with Larz
Part of the learn-to-code toolkit in the Larz stack — see the Learn to Code platform.
Tests
python -m unittest discover -s tests -v # 9 tests
License
MIT (c) larz-scripter
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file larztime-0.1.0.tar.gz.
File metadata
- Download URL: larztime-0.1.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d72c76a9067b152f2e637391d416eee1bd034276946d5764a550ce15ed90cd91
|
|
| MD5 |
86b1a148bbc22c332b86709d2743217b
|
|
| BLAKE2b-256 |
2489c0ef06e0c5917ca7aa1c8ff47c57fb370ee1f9b9660cc832ff0364bf0401
|
File details
Details for the file larztime-0.1.0-py3-none-any.whl.
File metadata
- Download URL: larztime-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fda7c472dbe2e923a6a07af2d39c494ec0e0740451b59d62f1dc795773a23fd
|
|
| MD5 |
da13d365ccbacc29c430fa5e4e276c7f
|
|
| BLAKE2b-256 |
669b319b5b2485b5158c9b6552cf19b0565cef7f1944010e8b7d49ef1eeac196
|