Commit Graph

178 Commits

Author SHA1 Message Date
Waldir Pimenta 176dfeff87 Reword 'same to' --> 'same as' 2019-12-29 22:27:59 +00:00
Brandon W Maister b5015c634b
Merge pull request #348 from gThorondorsen/test-num_days_from_ce
Test `Datelike::num_days_from_ce` against an alternative implementation
2019-12-23 17:19:43 -05:00
Gwaihir Thorondorsen 3e592d4565 Test `Datelike::num_days_from_ce` against an alternative implementation 2019-12-23 13:28:46 -05:00
Brandon W Maister 5ca6ff5afc Make it harder to accidentally use private features
In particular if built with `--all-features` or `features = "all"` we don't
want to accidentally make it look like `YearFlags` are something that people
should use. So: hide it from docs and put it behind a dunder.
2019-12-23 13:26:05 -05:00
Brandon W Maister 495243ae3c
Merge pull request #369 from quodlibetor/finish-criterion
Finish moving all benchmarks to criterion
2019-11-30 19:45:37 -05:00
Brandon W Maister 4f1c35827f Finish moving all benchmarks to criterion
I didn't delete some, apparently, and an internal struct had to be made public
to get its benchmark to work.
2019-11-30 18:11:03 -05:00
coolreader18 c5973277e7
Don't do wasmbind on wasi 2019-11-26 23:57:51 -06:00
Brandon W Maister 41700d101e Remove unused constant, deny(dead_code) 2019-11-23 19:58:20 -05:00
Brandon W Maister 5b4fc23bcb
Merge pull request #360 from quodlibetor/chrono-0_4_10
Prepare for and Bump Chrono version to 0.4.10
2019-11-23 19:53:58 -05:00
Brandon W Maister 288f1dd76f
Merge pull request #356 from quodlibetor/num_days_from_epoch-docs
Remove num_days_from_epoch
2019-11-23 19:29:23 -05:00
Brandon W Maister 6622bdcae7 Replace all uses of `try!` with question mark
The `?` operator was stabilized in 1.13, this gets rid of a few hundred
deprecation warnings.

Fixes #357
2019-11-23 19:18:08 -05:00
Brandon W Maister 27f5e5e9b3 Temporarily globally allow deprecated
The question mark will be fixed in a pending commit
2019-11-23 18:22:40 -05:00
Michal Srb db8784f97c Fix existing benchmarks
The #[cfg(bench)] attribute does not exist and is always false. Lets
define a feature "bench" which can be used to enable benchmarks when
building with nightly.
2019-11-23 23:34:59 +01:00
Brandon W Maister d9929a60b4
Merge pull request #341 from CryZe/no-std
Implement Support for no_std
2019-11-22 16:53:09 -05:00
Brandon W Maister a74a9744f1 Remove num_days_from_epoch
Deciding between zero-indexed (slightly more reasonable, more compatible with
the outside world) and one-indexed (same indexing as `num_days_from_ce`) seems
not worth it. It's trivial to build `num_days_from_epoch` based on the docs in
`num_days_from_ce`, which punts on the decision and is therefor probably the
right decision.
2019-11-16 16:48:47 -05:00
Gwaihir Thorondorsen bfdef11d0b Clarify documentation of `num_days_from_ce` methods
The new wording tries to make clearer that those methods use a 1-based
numbering scheme.

This commit also includes a couple of drive-by cosmetic changes.
2019-10-08 19:04:43 +02:00
Brandon W Maister 911dc57402 support rust v1.13.0 struct initialization syntax 2019-09-20 11:41:23 -04:00
Brandon W Maister a09f9ba2a8 Test against serde with no features in both std and no-std 2019-09-20 10:50:28 -04:00
Brandon W Maister 505db4504d Add Datelike::num_days_from_epoch 2019-09-18 17:48:39 -04:00
Brandon W Maister e5bbc94c3b First pass at making "alloc" its own feature
Part of this means that we don't actually need to allocate to write to Serde
any more, which is a win in its own right.
2019-09-15 20:45:49 -04:00
Brandon W Maister 4027bbb66d Rename serde-1 back to serde 2019-09-13 14:49:41 -04:00
Christopher Serr e62a054cd9 Introduce an `alloc` feature 2019-09-09 13:51:10 +02:00
Christopher Serr 9dc91f78ed Implement Support for no_std
This adds a new `std` feature to chrono that is enabled by default. By
deactivating this feature via `default-features = false` you can now use
chrono in applications that don't use the standard library. The `serde`
feature is supported as well.

Resolves #336
2019-09-07 12:12:49 +02:00
Brandon W Maister 2839d8d7db Put wasm-bindgen and js-sys behind a wasm-bindgen feature gate
Fixes #334
2019-09-03 09:05:15 -04:00
eV cc073a650f remove cargo web / compile time error 2019-08-22 08:09:56 +00:00
eV f21b1fbf21 Fix emscripten and guard against cargo test + wasm32-unknown-unknown 2019-08-16 22:46:10 +00:00
Joey Ezechiels 8bfaca9f9b Add {Utc,Local}::now() constructor versions for the `wasm32` arch
While likely providing only incomplete support for WebAssembly, this
commit opens up chrono for use on the wasm32 architecture.
2019-08-16 07:46:02 +00:00
Lane Kolbly c80878ce4e Change src/lib rather than readme directly 2019-07-18 07:37:37 -05:00
Guillaume Gomez b7003373f2 Add doc-comment to test README examples and fix README examples 2019-04-30 23:29:57 +02:00
Brandon W Maister 5dc483990a
Merge pull request #282 from 3point2/doc-grammar
Grammar fix for docs
2018-11-26 23:23:36 -05:00
Vasili Revelas 8abaae199e Grammar fix for docs 2018-10-27 13:09:32 +03:00
Pascal Bach fd22be2c8f Correct link to standard Durtation
The link mentioning standard Duration was still linking to the
Duration from the time crate
2018-10-09 23:19:59 +02:00
Brandon W Maister 2e563bc652 Make README.md match lib.rs mod documentation
And fail CI in the future if `make readme` isn't run when it is needed.

CC conversation in #185, where the README didn't get updated for a year after
lib.rs was improved.
2018-08-25 16:24:07 -04:00
Brandon W Maister 369ce72987
Merge pull request #252 from quodlibetor/negative-timestamps
Add doctests around negative timestamps
2018-07-28 17:07:04 -04:00
Brandon W Maister a58a833324 Add doctests for negative timestamps 2018-07-28 16:40:26 -04:00
Brandon W Maister 5481dec823 Don't warn on an unknown allowed clippy lint 2018-07-28 15:25:37 -04:00
storyfeet 611abbd7ae trivially copy pass by ref 2018-07-18 21:38:37 -04:00
storyfeet b9b09b8e11 Tried to make it easier to find specifiers 2018-07-18 21:38:37 -04:00
Brandon W Maister a9618c8e9d
Merge branch 'master' into feature_clock 2018-04-03 05:54:17 -07:00
Jethro Beekman 5e68c60bb2 Add clock feature 2018-04-02 08:35:27 -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 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
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 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
David Kellum 1a0ebe7e30 Add more specific SecondsFormat and offer single to_rfc3339_opts 2018-01-25 14:25:04 -08:00
David Kellum 4748225550 allow(const_static_lifetime) is for feature cargo-clippy 2018-01-12 16:17:53 -08:00