[][src]Crate humantime

Human-friendly time parser and formatter

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.

See serde-humantime for serde integration.

Structs

Duration

A wrapper for duration that has FromStr implementation

FormattedDuration

A wrapper type that allows you to Display a Duration

Rfc3339Timestamp

A wrapper type that allows you to Display a SystemTime

Timestamp

A wrapper for SystemTime that has FromStr implementation

Enums

DurationError

Error parsing human-friendly duration

TimestampError

Error parsing datetime (timestamp)

Functions

format_duration

Formats duration into a human-readable string

format_rfc3339

Format an RFC3339 timestamp 2018-02-14T00:28:07Z

format_rfc3339_micros

Format an RFC3339 timestamp 2018-02-14T00:28:07.000000Z

format_rfc3339_millis

Format an RFC3339 timestamp 2018-02-14T00:28:07.000Z

format_rfc3339_nanos

Format an RFC3339 timestamp 2018-02-14T00:28:07.000000000Z

format_rfc3339_seconds

Format an RFC3339 timestamp 2018-02-14T00:28:07Z

parse_duration

Parse duration object 1hour 12min 5s

parse_rfc3339

Parse RFC3339 timestamp 2018-02-14T00:28:07Z

parse_rfc3339_weak

Parse RFC3339-like timestamp 2018-02-14 00:28:07