Go to file
openharmony_ci 136e774536
!2 Add OAT.xml and README.OpenSource
Merge pull request !2 from fangting/master
2023-04-14 08:10:36 +00:00
benches Fix clippy warnings 2020-01-17 22:35:04 +08:00
src Expose inner values from formatting wrappers (#18) 2021-01-13 17:16:57 +02:00
.gitignore Initial implementation 2016-05-21 00:06:38 +03:00
.travis.yml Remove CARGO_TOKEN from .travis.yml 2021-01-13 17:18:15 +02:00
BUILD.gn Add GN Build Files and Custom Modifications 2023-04-12 17:26:09 +08:00
bulk.yaml Update vagga.yaml according to the new stardards 2018-02-14 02:25:02 +02:00
Cargo.toml Version bumped to v2.1.0 2021-01-13 18:01:04 +00:00
LICENSE-APACHE Add README and LICENSE files 2016-05-21 00:06:45 +03:00
LICENSE-MIT Update license info 2018-02-16 00:59:19 +02:00
README.md Update README to refer to humantime-serde 2019-08-31 18:25:38 +03:00
README.OpenSource Add OAT.xml and README.OpenSource 2023-04-14 14:14:52 +08:00
vagga.yaml vagga.yaml: upgrade rust to 1.31.0 2020-01-19 02:56:53 +02:00

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

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.