Commit Graph

464 Commits

Author SHA1 Message Date
jean-airoldie c92544923d Add timestamp_nanos generated method for TimeZone 2019-03-06 10:32:40 -05:00
Brandon W Maister 77110ffecb
Merge pull request #292 from cmars/negative_timestamp_millis
Fix panic for negative inputs to timestamp_millis.
2018-12-04 15:47:03 -05:00
Casey Marshall b39597f537 Fix panic for negative inputs to timestamp_millis.
This patch fixes the case where a negative millisecond offset is passed
to Timezone::timestamp_millis and timestamp_millis_opt and adds a test
case for it. Without this patch, calling timestamp_offset with a
negative value will panic with an overflow like this:

```
---- tests::test_parse_samples stdout ----
thread 'tests::test_parse_samples' panicked at 'attempt to multiply with
overflow',
/home/c/.cargo/registry/src/github.com-1ecc6299db9ec823/chrono-0.4.6/src/offset/mod.rs:349:34
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a
verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing:👿:unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:221
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:477
   5: std::panicking::continue_panic_fmt
             at libstd/panicking.rs:391
   6: rust_begin_unwind
             at libstd/panicking.rs:326
   7: core::panicking::panic_fmt
             at libcore/panicking.rs:77
   8: core::panicking::panic
             at libcore/panicking.rs:52
   9: chrono::offset::TimeZone::timestamp_millis_opt
             at
/home/c/.cargo/registry/src/github.com-1ecc6299db9ec823/chrono-0.4.6/src/offset/mod.rs:349
  10: chrono::offset::TimeZone::timestamp_millis
             at
/home/c/.cargo/registry/src/github.com-1ecc6299db9ec823/chrono-0.4.6/src/offset/mod.rs:327
```
2018-12-02 11:26:42 -06: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
Brandon W Maister 9ab410728c
Merge pull request #279 from bachp/duration-link
Correct link to standard Durtation
2018-11-26 23:22:35 -05:00
Brandon W Maister 8c1817d98e
Merge pull request #283 from ignatenkobrain/patch-2
exclude CI files from crates.io
2018-11-26 23:20:46 -05:00
Igor Gnatenko 5f74978778
exclude CI files from crates.io 2018-10-31 12:11:46 +01: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 94b43fa2e8 Bump Chrono version to 0.4.6 2018-08-25 16:47:10 -04:00
Brandon W Maister 5a1c702b60
Merge pull request #275 from quodlibetor/ci-for-readme
Make README.md match lib.rs mod documentation
2018-08-25 16:45:18 -04: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 a648423e94
Merge pull request #274 from Eh2406/minimal-versions
bump time to use winapi 0.3
2018-08-18 18:25:17 -04:00
Finkelman 701d36536b bump rustc-serialize to a vertion that builds on modern rust 2018-08-18 15:29:48 -04:00
Eh2406 5fc6edd928 bump time to use winapi 0.3 2018-08-17 19:00:37 -04:00
Brandon W Maister b49848d680
Merge pull request #269 from afgomez/patch-1
Update broken links to `time::Duration`
2018-08-14 11:04:31 -04:00
Alejandro Fernández 4b2a287776
Update broken links to `time::Duration` 2018-08-06 20:41:02 +02:00
Brandon W Maister 8fceba82f4 Bump Chrono version to 0.4.5 2018-07-28 17:12:03 -04:00
Brandon W Maister b975d7a2ff Add another change to the changelog 2018-07-28 17:09:40 -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 55538b5b9c
Merge pull request #268 from quodlibetor/TimeZone-timestamp-millis
Add `timestamp_millis` and `timestamp_millis_opt`
2018-07-28 16:41:34 -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
Brandon W Maister ffb27b8cc7 Add changelog entries for already-merged changes 2018-07-28 15:24:48 -04:00
Brandon W Maister 19955ac992 Add `timestamp_millis` and `timestamp_millis_opt`
Fixes #264
2018-07-28 15:18:32 -04:00
Brandon W Maister 512f21d481
Merge pull request #258 from novacrazy/extra-serde
Extra serde modules for various timestamp formats.
2018-07-28 14:45:42 -04:00
Brandon W Maister ad543a75ef
Merge pull request #267 from davidtwco/playground-metadata
Enable all features on Rust Playground.
2018-07-28 14:39:44 -04:00
David Wood b57e815da7
Enable all features on Rust Playground. 2018-07-21 19:24:24 +01:00
Brandon W Maister 7b612e9ae0
Merge pull request #261 from storyfeet/format-pointer
Tried to make it easier to find specifiers
2018-07-18 21:54:53 -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
novacrazy a88ee8f719 Fix doc 2018-07-18 04:45:11 -05:00
novacrazy 4a66b17bd0 Add docs/tests and fix math 2018-07-04 14:12:36 -05:00
novacrazy 5df91c3985 Add WIP millisecond serde implementation 2018-07-04 10:38:39 -05:00
Brandon W Maister e165a93a6c
Merge pull request #254 from LuoZijun/patch-1
Add Hash trait on FixedOffset
2018-06-24 13:29:53 -04:00
寧靜 a99dee655e Update fixed.rs 2018-06-24 05:45:24 +08:00
Brandon W Maister 237042365e Update for 0.4.4 2018-06-23 17:32:44 -04:00
Brandon W Maister 7baafafc0c
Merge pull request #251 from emschwartz/master
Add nanoseconds without dots
2018-06-17 12:30:37 -04:00
Brandon W Maister df4912a33f Test formatting with more precise nanoseconds
There is some specific behavior around writing out truncated nanos that we want
to be sure to preserve.
2018-06-13 23:00:31 -04:00
Evan Schwartz 11cfb3696e Move NanosecondXNoDot to internal enum
To avoid adding new variants to the public enum (see https://github.com/chronotope/chrono/pull/251#issuecomment-396692148)
2018-06-12 14:53:49 -04:00
Evan Schwartz 937189ee52 Take exactly num digits specified for nanosecond fixed
Error if it's too long or short, and don't take any more digits
2018-06-12 10:51:38 -04:00
Evan Schwartz 8a2b09962a Only parse up to max number of digits for nanoseconds w/o dots 2018-06-12 10:51:38 -04:00
Evan Schwartz 074e92fc63 Document millisecond format without the dot 2018-06-12 10:51:36 -04:00
Evan Schwartz f9d3094d4e Test nanosecond parsing without the dot 2018-06-12 10:51:07 -04:00
Evan Schwartz 1de3658433 Add nanoseconds without dots 2018-06-12 10:51:07 -04:00
Brandon W Maister 0ef8c5cc83 Bump Chrono Version to 0.4.3 2018-06-10 21:36:36 -04:00
Brandon W Maister f1852a6d21 Update changelog with TZ Offset Permissive 2018-06-10 21:35:41 -04:00
Brandon W Maister 3c6e807672
Merge pull request #242 from quodlibetor/add-permissive-tz-parsing
Add %#z as "Permissive" timezone parsing
2018-06-10 20:38:09 -04:00
Brandon W Maister c3207a5811 Use the `InternalFixed` struct for TimezoneOffsetPermissive
It is the backcompat scheme that we have. In the 5.x timeline we will add the
more-standard and significantly-more-pleasant-to-expand `#[doc(hidden)]
__DoNotMatchAgainstMe` trick.
2018-06-07 21:46:57 -04:00
Brandon W Maister 9991c2b0ed Rust 1.13 does not support elided lifetimes in const. 2018-06-07 21:46:57 -04:00