ts — Instant Timestamp Converter
Zero-dependency CLI tool for bidirectional epoch ↔ human-readable timestamp conversion.
Install
Option 1: curl (fastest)
curl -fsSL https://raw.githubusercontent.com/ericjoye/ts-cli/main/ts \
-o /usr/local/bin/ts && chmod +x /usr/local/bin/ts
Option 2: pip
pip install ts-epoch
Option 3: copy
cp ts /usr/local/bin/ts && chmod +x /usr/local/bin/ts
Requires Python 3.9+ (uses zoneinfo from stdlib). No pip dependencies.
Usage
ts # Current time: epoch (s/ms/μs) + UTC + local
ts 1718901234 # Epoch seconds → human
ts 1718901234000 # Epoch milliseconds → human (auto-detected)
ts 1718901234000000 # Epoch microseconds → human (auto-detected)
ts "2024-06-20T14:33:54Z" # ISO 8601 → epoch
ts "2024-06-20 14:33:54" # Human → epoch
ts now # Current epoch in seconds
ts 1718901234 1718902000 # Batch: multiple timestamps
cat timestamps.txt | ts --stdin # Pipe mode
ts 1718901234 --tz America/New_York # Convert to timezone
ts 1718901234 --local # Convert to local timezone
Features
- Auto-detection: Distinguishes seconds (≤10 digits), milliseconds (11–13), microseconds (16+)
- Bidirectional: Epoch → human AND human → epoch
- ISO 8601: Full support for
YYYY-MM-DDTHH:MM:SSZand variants - Timezone support:
--tz IANA_NAMEor--localfor system timezone - Batch mode: Multiple args or
--stdinpipe - Zero dependencies: Single Python file, stdlib only
Running tests
pip install pytest
pytest test_ts.py -v
License
MIT
Metadata
Release files for ts-epoch 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 | Provenance | |
|---|---|---|---|---|
| ts_epoch-0.1.0.tar.gz | 5.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ts_epoch-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.8 kB
Release files / ts_epoch-0.1.0.tar.gz
| Download URL | ts_epoch-0.1.0.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0c9e94cad3a83a84d1e3c8f33461f24021520c0c71a03267f80900a560d1ba0e
|
|
BLAKE2b-256 checksum How to use checksums |
6601fedb7236ad4bbb465c3333eb454f24abe3119448f40635608da8bc719bb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / ts_epoch-0.1.0-py3-none-any.whl
| Download URL | ts_epoch-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6de34671257ddfa436668d37f50407b382413ed1bf846e7b7e75d00da5c7f8ef
|
|
BLAKE2b-256 checksum How to use checksums |
e2d8e89d21cb3a8e425c7298667ced5fccf71166ce279a6b47dfe36dd3e5fcac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for ts-epoch 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.