Commit Graph

440 Commits

Author SHA1 Message Date
Jethro Beekman 6c398ae6f4 Remove dependencies from oldtime::Duration on rest of time crate 2018-03-30 16:08:45 -07:00
Jethro Beekman 5e730ebe4d Vendor oldtime::duration module from time crate
https://github.com/rust-lang-deprecated/time/blob/master/src/duration.rs
2018-03-30 16:08:45 -07:00
Jethro Beekman c368bf16d0 Adjust features selection in CI 2018-03-30 16:08:45 -07:00
Brandon W Maister 39ca2e622c Deprecated warnings in cargo output for rustc-serialize feature
Unfortunately due to rust-lang/rust#39935 placing the annotation on the `impl`s
of `Encodable`/`Decodable` for the various items have no effect whatsoever, so
we need to place it on some type that chrono actually uses internally. The only
*type* that I can find that only exists for rustc-serialize only is the
 `TsSeconds` struct.

So, marking TsSeconds deprecated causes Chrono's internal uses of `TsSeconds`
to emit deprecation warnings, both in our builds and for packages that specify
Chrono as a dependency with the `rustc-serialize` feature active. This means
that the current commit will cause a `warning: use of deprecated item:
RustcSerialize will be removed before chrono 1.0, use Serde instead` to appear
in `cargo build` output.

Unfortunately I don't think that it's possible for downstream crates to disable
the warning the warning in any way other than actually switching to Serde or
using an older chrono. That's the reason for all the `#[allow(deprecated)]`
through the code, it means that the warning appears almost exactly once,
instead of dozens of times.
2018-03-29 14:32:39 -04:00
Brandon W Maister ee52f2f02c
Merge pull request #228 from quodlibetor/0.4.1-release
0.4.1 release
2018-03-27 22:03:00 -04:00
Brandon W Maister 1ddc67ce11 Bump version to 0.4.1 2018-03-26 22:58:57 -04:00
Brandon W Maister d889e3838f Update changelog for 0.4.1 2018-03-26 22:10:45 -04:00
Brandon W Maister 1a983261e3 Ensure that `SecondsFormat` can be expanded semver-safely 2018-03-26 22:10:21 -04:00
Brandon W Maister c9609ea6c9
Merge pull request #217 from dekellum/round
Add SubsecRound trait
2018-03-05 23:23:47 -05:00
David Kellum 449d7277b9 Rename SubSecondRound to SubsecRound
Per review request.
2018-03-05 12:57:26 -08:00
David Kellum 08b7e0bc6b Fix prelude SubSecondRound 2018-03-05 10:40:50 -08:00
David Kellum cb3a73aa86 Rename to (round/trunc)_subsecs; add doc tests 2018-03-05 10:38:48 -08:00
David Kellum 74ec7aa5b2 Improve up/down variable naming 2018-03-04 18:27:36 -08:00
Brandon W Maister 2a825edd5c
Merge pull request #221 from cuviper/num-no_std
Use no_std-compatible num dependencies
2018-03-04 18:21:50 -05:00
Brandon W Maister 312d0898d9
Merge pull request #223 from quodlibetor/allow-clippy-lint
Allow a clippy lint that depends on rust 1.17
2018-03-04 10:32:37 -05:00
Brandon W Maister 7f990144cc Allow a false-positive clippy lint
rust-lang-nursery/rust-clippy#2475 , we'll revert this commit when that's
fixed.
2018-03-04 09:51:41 -05:00
Brandon W Maister 2ee549f84f Allow a clippy lint that depends on rust 1.17 2018-03-04 09:18:02 -05:00
Josh Stone 8f90f405d5 Use no_std-compatible num dependencies
Rather than the `num` meta-crate, use `num-integer` and `num-traits`
without default features to make them `#[no_std]`.  `num-iter` is
just a dev-dependency now for a few test cases.

The only public change is the `impl FromPrimitive for Weekday`, but this
is still the same exact trait that `num` re-exports, so this is not a
breaking change.
2018-02-23 00:07:16 -08:00
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