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
Metadata
Release files for larztime 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| larztime-0.1.0.tar.gz | 6.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| larztime-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.8 kB
Release files / larztime-0.1.0.tar.gz
| Download URL | larztime-0.1.0.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d72c76a9067b152f2e637391d416eee1bd034276946d5764a550ce15ed90cd91
|
|
BLAKE2b-256 checksum How to use checksums |
2489c0ef06e0c5917ca7aa1c8ff47c57fb370ee1f9b9660cc832ff0364bf0401
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / larztime-0.1.0-py3-none-any.whl
| Download URL | larztime-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0fda7c472dbe2e923a6a07af2d39c494ec0e0740451b59d62f1dc795773a23fd
|
|
BLAKE2b-256 checksum How to use checksums |
669b319b5b2485b5158c9b6552cf19b0565cef7f1944010e8b7d49ef1eeac196
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|