MCPcopy Index your code
hub / github.com/chronotope/humantime

github.com/chronotope/humantime @v2.4.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.4.0 ↗ · + Follow
93 symbols 152 edges 6 files 13 documented · 14%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Human Time

Status: stable

Documentation | Github | Crate

Features:

  • Parses durations in free form like 15days 2min 2s
  • Formats durations in similar form 2years 2min 12us
  • Parses and formats timestamp in rfc3339 format: 2018-01-01T12:53:00Z
  • Parses timestamps in a weaker format: 2018-01-01 12:53:00

Timestamp parsing/formatting is super-fast because format is basically fixed.

Here are some micro-benchmarks:

test result: ok. 0 passed; 0 failed; 26 ignored; 0 measured; 0 filtered out

     Running target/release/deps/datetime_format-8facb4ac832d9770

running 2 tests
test rfc3339_chrono            ... bench:         737 ns/iter (+/- 37)
test rfc3339_humantime_seconds ... bench:          73 ns/iter (+/- 2)

test result: ok. 0 passed; 0 failed; 0 ignored; 2 measured; 0 filtered out

     Running target/release/deps/datetime_parse-342628f877d7867c

running 6 tests
test datetime_utc_parse_millis  ... bench:         228 ns/iter (+/- 11)
test datetime_utc_parse_nanos   ... bench:         236 ns/iter (+/- 10)
test datetime_utc_parse_seconds ... bench:         204 ns/iter (+/- 18)
test rfc3339_humantime_millis   ... bench:          28 ns/iter (+/- 1)
test rfc3339_humantime_nanos    ... bench:          36 ns/iter (+/- 2)
test rfc3339_humantime_seconds  ... bench:          24 ns/iter (+/- 1)

test result: ok. 0 passed; 0 failed; 0 ignored; 6 measured; 0 filtered out

See humantime-serde for serde integration (previous crate serde-humantime looks unmaintained).

License

Licensed under either of

  • Apache License, Version 2.0, (./LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (./LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Extension points exported contracts — how you extend this code

OverflowOp (Interface)
(no doc) [1 implementers]
src/duration.rs

Core symbols most depended-on inside this repo

parse_rfc3339
called by 24
src/date.rs
mul
called by 17
src/duration.rs
div
called by 9
src/duration.rs
item
called by 7
src/duration.rs
two_digits
called by 7
src/date.rs
off
called by 6
src/duration.rs
from_sec
called by 5
src/date.rs
add
called by 3
src/duration.rs

Shape

Function 63
Method 19
Class 6
Enum 4
Interface 1

Languages

Rust100%

Modules by API surface

src/date.rs42 symbols
src/duration.rs35 symbols
src/wrapper.rs8 symbols
benches/datetime_parse.rs6 symbols
benches/datetime_format.rs2 symbols

For agents

$ claude mcp add humantime \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact