humantime
A fast parser and formatter for std::time::Duration and SystemTime in human-friendly notation
Repository Health
Technical Analysis
humantime parses and formats Rust’s standard-library Duration and SystemTime types using human-friendly notation, such as 15days 2min 2s for durations and RFC 3339 timestamps like 2018-01-01T12:53:00Z. It’s designed to be extremely fast since the timestamp format it produces and consumes is effectively fixed, avoiding the overhead of general-purpose calendar libraries for the common case of reading/writing timestamps and durations in config files, logs, and CLIs.
Maintained under the chronotope organization (which also maintains the chrono date/time crate), humantime is a small, stable, widely depended-upon utility crate with nearly 400 million total downloads, commonly pulled in as a dependency of logging and CLI-configuration crates like env_logger.
What You Get
parse_duration()/format_duration()- free-form duration notation like15days 2min 2sin both directionsparse_rfc3339()/format_rfc3339()- RFC 3339 timestamp parsing and formatting for SystemTime, benchmarked far faster than general calendar libraries for this fixed format- A weaker timestamp parser accepting space-separated dates like
2018-01-01 12:53:00 Duration/Timestampwrapper types implementingFromStr/Displayfor direct use withclapargument parsing orserde- Companion crate
humantime-serdefor direct serde integration (the README notes the olderserde-humantimecrate is unmaintained)
Common Use Cases
- Parsing CLI flags like
--timeout 30sor--retention 7daysinto std::time::Duration via clap integration - Reading/writing human-readable durations and timestamps in config files (YAML/TOML) without pulling in a full calendar library
- Formatting log timestamps in RFC 3339 with minimal overhead — used internally by env_logger for its timestamp output
- Any place a Rust program needs quick, allocation-light SystemTime/Duration <-> string conversion
Under The Hood
Architecture - The crate is small and focused: duration.rs implements the free-form duration grammar (parsing tokens like 15days, 2min) and its formatter, date.rs implements the RFC 3339 timestamp parser/formatter plus the looser space-separated variant, and wrapper.rs provides the newtype wrappers (Duration, Timestamp) implementing FromStr/Display so the crate’s types slot directly into clap or serde without adapter code. Tech Stack - Zero required runtime dependencies beyond std; dev-dependencies include bencher for micro-benchmarks and the time crate (for comparison benchmarks against chrono/time in benches/), edition 2021, MSRV 1.60, dual MIT/Apache-2.0 licensed. Code Quality - date.rs and duration.rs carry 26 and 14 inline #[test] functions respectively covering parse/format round-trips and edge cases; the README documents concrete benchmark numbers (e.g. RFC 3339 parsing at ~24-36ns/iter versus ~737ns/iter for chrono) demonstrating the performance claims are backed by tracked benchmarks rather than assertions. API Design - The API is deliberately minimal — four core functions plus two wrapper types — favoring a handful of well-named free functions over a builder or configuration object, which keeps the learning curve low at the cost of configurability (e.g. the timestamp format is effectively fixed rather than customizable).
Used by 8 apps in this directory
headroom
AI Development · Developer Tools
Compress everything your AI agent reads — tool outputs, logs, RAG chunks, and files — before it reaches the LLM, achieving 60–95% fewer tokens with the same answers.
Hook0
Devops
Open-source Webhooks-as-a-Service: deliver events to your users with auto-retry, signed payloads, and a real-time subscriber dashboard — all without building the infrastructure yourself.
iii
Developer Tools · Devops
Compose, extend, and observe every backend service in real time using three primitives: Workers, Functions, and Triggers.
InfluxDB
Databases · Analytics
Open-source time-series database built for real-time ingest, fast SQL queries, and embedded Python automation — powered by Apache Arrow and Parquet.
Meilisearch
Search
Lightning-fast hybrid search engine with AI-powered semantic and full-text retrieval for modern applications.
ParadeDB
Search · Databases · Analytics
Born out of Y Combinator's S2023 batch, ParadeDB is a Postgres extension that delivers Elasticsearch-quality BM25 search and real-time analytics without a separate search cluster to manage.
QuestDB
Databases · Analytics
A high-performance, open-source time-series database built for financial market data, IoT telemetry, and real-time analytics, combining a zero-GC Java/C++ core with SIMD-accelerated SQL and a WAL-to-Parquet storage engine.
Spacedrive
File Storage · Collaboration
One file manager for all your devices and clouds — powered by a Virtual Distributed File System built in Rust.