Commit Graph

372 Commits

Author SHA1 Message Date
David Kellum b5acb0ed95 Add SubSecondRound extension trait with impl for Timelike 2018-01-30 12:12:16 -08:00
Brandon W Maister ff962d452c
Merge pull request #205 from dekellum/rfc3339pz
Add DateTime to_rfc3339p(z) methods, tests
2018-01-29 22:16:53 -05:00
Brandon W Maister d403eeb43a
Merge pull request #213 from lancecarlson/master
Update README.md
2018-01-29 22:12:05 -05:00
David Kellum e8fdbdf41d Rustdoc and naming improvements 2018-01-26 11:42:08 -08:00
David Kellum 1a0ebe7e30 Add more specific SecondsFormat and offer single to_rfc3339_opts 2018-01-25 14:25:04 -08:00
Lance Carlson 11ee30cd77
Update README.md 2018-01-24 18:55:10 -05:00
Lance Carlson 884ad92802
Update README.md
Include the decimal values in the default output format
2018-01-24 11:50:25 -05:00
Brandon W Maister aa0fbc1879
Merge pull request #211 from kennytm/master
Fix a markdown rendering difference warning.
2018-01-21 18:58:54 -05:00
kennytm 8a6a99018a
Fix a markdown rendering difference warning.
Rust is going to change its Markdown rendering engine from hoedown to
pulldown-cmark. In pulldown, a table row starting with just whitespaces
will cause that whole cell disappeared. This causes rendering difference
between the two engines.

To fix this, we add leading and trailing `|` to the rows so that empty
cells are correctly rendered.
2018-01-22 02:34:15 +08:00
David Kellum efb0f3b015 Clippy no likey a match on bool 2018-01-18 11:07:23 -08:00
David Kellum 0e6d1d49b7 cleanup name resolution for backward compatibility
so it builds with rustc 1.13
2018-01-18 11:07:23 -08:00
David Kellum 353a7bbbc4 Use const for compat with rustc 1.13-16
Was using static but that's only supported as of rustc 1.17 (rust
these older versions. Also continue using the copious explicit 'static
lifetimes for the same compatibility, despite the clippy lint.
2018-01-18 11:07:23 -08:00
David Kellum d2bf1494b1 Add DateTime to_rfc3339p(z) methods, tests
These additions allow convenient control of RFC 3339 formatted output:

 * Number of subsecond digits to display

 * Whether to use the 'Z' variant, instead of "+00:00" for TZ offset
   0, UTC.

...while remaining faithful to the RFC 3339. The implementation uses
the existing formatting Item mechanism.

github: cc: #157 #178
2018-01-18 11:07:23 -08:00
Brandon W Maister 232a0f1255
Merge pull request #206 from dekellum/clippy-allow-static-lifetime-for-now
Clippy allowances to get the build passing again
2018-01-18 13:25:24 -05:00
David Kellum 9742ecccc5 Allow (clippy) needless_pass_by_value on signed_duration_since
Current clippy is probably correct, but its a breaking change that
isn't appropriate now. Add allow's to get the build working again.

Also these Date(Time)::signed_duration_since cases appear to match
there `Naive` counterparts, where clippy isn't complaining. If its
fixed in the future, should probably be changed across the board, not
just here.
2018-01-17 11:49:06 -08:00
David Kellum 4748225550 allow(const_static_lifetime) is for feature cargo-clippy 2018-01-12 16:17:53 -08:00
David Kellum f93c8a993d Add top level clippy allow const_static_lifetime
github: cc: #205
2018-01-12 15:16:06 -08:00
Brandon W Maister ac48f514bc Merge pull request #190 from quodlibetor/document-parse-from-str
Add a note and example to DateTime::parse_from_str
2017-10-09 22:19:01 -04:00
Brandon W Maister 5bb493976b Add a note and example to DateTime::parse_from_str
The note points out that `NaiveDateTime::parse_from_str` is required if you
don't know the offset, and the example demonstrates that.

Closes #183
2017-10-09 21:23:22 -04:00
Brandon W Maister f8e4b55bf6 Merge pull request #188 from alatiera/master
Examples/doctests for getting a datetime from an epoch and viceversa.
2017-10-09 10:11:39 -04:00
Jordan Petridis 1286ad12d3
Merge branch 'master' of https://github.com/chronotope/chrono 2017-10-09 15:30:08 +03:00
Jordan Petridis 57c98a409e
Added underscores on long numbers. 2017-10-09 14:47:07 +03:00
Brandon W Maister 82358f4408 Merge pull request #189 from quodlibetor/more-clippy
More clippy fixes
2017-10-08 21:12:45 -04:00
Jordan Petridis 532c025a77
Minor doc wording changes. 2017-10-09 02:03:18 +03:00
Brandon W Maister c3fa1b5f17 Fix Clippy lints: cast_lossless
Now (assuming clippy is right) all (~100) uses of ` as ` in the code are
actually doing casts that could potentially silently lose data. Woooo?

At least this means that new `as`s can be extra-scrutinized, and we should
probably be adding debug_assert!s for the casts in real code.
2017-10-08 18:12:20 -04:00
Brandon W Maister 268be10d79 Fix Clippy lints: unreadable_literal and inconsistent_digit_grouping
Use `_` consistently in long numeric literals.
2017-10-08 17:38:41 -04:00
Jordan Petridis 7e2f2e0bea
Added examples/doctests for how to get a datetime from an epoch and vice versa. 2017-09-29 19:24:40 +03:00
Brandon W Maister b3adf050f5 Merge pull request #185 from kosta/readme-timestamps
Add doc comment to lib.rs: Conversion from and to EPOCH timestamps
2017-09-26 20:50:59 -04:00
Brandon W Maister 065a7ec29e Merge pull request #186 from upsuper/rfc2822-omittable-second
fix rfc2822 parsing to allow omitting second
2017-09-26 20:47:41 -04:00
Xidorn Quan 0eeb4746f2 fix rfc2822 parsing to allow omitting second 2017-09-19 21:52:07 +10:00
Kosta Welke 0853499bec Add doc comment to lib.rs: Conversion from and to EPOCH timestamps 2017-09-04 15:04:07 +02:00
Brandon W Maister 5c0b773668 Merge pull request #176 from jonasbb/master
Fix Allow parsing of timestamps with additional subsecond precision
2017-07-15 11:24:07 -05:00
Jonas Bushart 4eacc1416e Additional tests which test parsing of %s in combination with %f/%.3f/... 2017-07-15 16:27:56 +02:00
Jonas Bushart 5124c0c324 Fix Allow parsing of timestamps with additional subsecond precision
Fixes https://github.com/chronotope/chrono/issues/175
2017-07-14 11:32:15 +02:00
Brandon W Maister 927763b6b3 Merge pull request #173 from quodlibetor/doc-timestamp-opt
Mention timestamp_opt in the docs for timestamp
2017-07-09 20:44:57 -05:00
Brandon W Maister cd6a35774e Merge pull request #172 from quodlibetor/add-timestamp-millis
Add `timestamp_millis` method to DateTime and NaiveDateTime
2017-07-09 16:46:55 -05:00
Brandon W Maister d99304145b Add `timestamp_millis` method to DateTime and NaiveDateTime
Fixes #151
2017-07-09 16:31:06 -05:00
Brandon W Maister ec6c31e863 Mention timestamp_opt in the docs for timestamp
Influenced by #110
2017-07-09 16:19:34 -05:00
Brandon W Maister 91d5dd46cf Merge pull request #164 from quodlibetor/enable-clippy
Enable Clippy for all builds in Travis
2017-07-09 15:48:20 -05:00
Brandon W Maister ce6ea4d8d1 deny(missing_debug_implementations) 2017-07-09 15:23:07 -05:00
Brandon W Maister 1f625fe69d Enable Clippy in travis
This will run clippy on all builds, and as long as clippy successfully compiles
it will deny builds that fail clippy lints.
2017-07-09 15:23:07 -05:00
Brandon W Maister 5643b845a5 Allow Clippy lint: derive_hash_xor_eq
The implementation is identical to how #[derive] would do it, and we use the
implementation to add some documentation warning people not to use items with
nanosecond-level precision in hash maps unless they're sure that's what they
want.
2017-07-09 15:23:06 -05:00
Brandon W Maister 4c18d701ca Allow Clippy lint: cyclomatic complexity
Honestly this function is pretty clear, breaking it up makes it seem worse.
2017-07-09 15:10:26 -05:00
Brandon W Maister 330504792b Fix Clippy lints: match_same_arms 2017-07-09 15:10:26 -05:00
Brandon W Maister 0dc4e3a416 Fix Clippy lints: type_complexity 2017-07-09 15:10:26 -05:00
Brandon W Maister 96b31283d0 Fix Clippy lints: if_same_then_else 2017-07-09 15:10:26 -05:00
Brandon W Maister 4a70e160fb Fix Clippy lints: or_fun_call 2017-07-09 15:10:26 -05:00
Brandon W Maister fd6036a8b9 Fix Clippy lints: assign_op_pattern 2017-07-09 15:10:26 -05:00
Brandon W Maister de7f0f64f7 Fix Clippy lints: needless_pass_by_value 2017-07-09 15:10:26 -05:00
Brandon W Maister c63a012253 Fix Clippy lints: needless_lifetimes 2017-07-09 15:10:26 -05:00