Coder Social home page Coder Social logo

rust-humantime's Introduction

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.

rust-humantime's People

Contributors

ryanhigh avatar deepin-community-ci-bot[bot] avatar

Watchers

Han Gao avatar zccrs avatar LIChengGang avatar

Forkers

ryanhigh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.