The exact condition is that the `Duration` to be added is negative
and has a fractional second part. This was not a problem when
`Duration` was Chrono's own type, but a new code for external (then
libstd, now libtime) `Duration` was not tested for this condition
by accident. Consequently this condition caused an underflow in
the fractional part, resulting in a slight inaccuracy.
Fixes#37.
- This version is finally beta-compatible.
This introduces a slight incompatibility, namely, due to
the rewired reexport for `chrono::Duration` (which now comes
from crates.io `time` crate).
- The optional dependency on `rustc_serialize` and relevant
`Rustc{En,De}codable` implementations for supported types
has been added. You will need the `rustc-serialize` Cargo
feature to use them.
- Many `std::num` traits are removed and replaced with
the external `num` crate. For time being, thus, Chrono will
require the dependency on `num`. This is expected to be temporary
however.
- Replaced `thread::scoped` with `thread::spawn` to cope with
a rare de-stabilization event.
- `#[deprecated]` is (ironically) deprecated with user crates.
All uses of them have been replaced by doc comments.
- Feature flags are now required on the doctests.
- New lints for trivial casts. We are now not going to change
the internal implementation type for `NaiveDate`, so that's fine.
This is due to somewhat ambiguous semantics of `Date`. It cannot
really constructed without an intermediate `DateTime` much like
the removed `Time`, but it is much more useful than `Time` so
we need some reasonable meaning to it. This commit clarifies
that meaning and corrects some problems around it:
- The date itself is timezone-agnostic unless the timezone itself
has an offset equal to or greater than one day. In all current
time zones, the date conversion should be a no-op.
- The date may be attached some offset; that offset should have
been occurred within the corresponding day in either the local
time or the UTC.
- `TimeZone` is free to assign the offset within this constraint.
For convenience, the current `Local` time zone assumes the local
midnight or the UTC midnight.
- `DateTime<Tz>` and `Date<Tz>` is now `Copy`/`Send` when
`Tz::Offset` is `Copy`/`Send`. The implementations for them were
mistakenly omitted. Fixes#25.
- `Local::from_utc_datetime` didn't set a correct offset.
The tests for `Local` were lacking. Fixes#26.
`Time` with an associated time zone is in principle possible, but
in practice it can only meaningfully constructed from an existing
`DateTime`. this makes it hard to implement other operations
natural to `NaiveTime` for `Time` (e.g. `with_*` methods), so
we simply let it go.
migration path: if you *do* happen to use `Time`, don't panic!
every operation possible to `Time` is much more possible to
`NaiveTime`. if you have to deal with a local time, first combine
it with a `NaiveDate`, convert it via `TimeZone::from_local_datetime`
then extract `Time` part again.
this is partly because... we are using the simple name `timestamp`
in the `Parsed` anyway. that value is so widespread enough that
its name can be simply THE timestamp. old methods have been marked
deprecated.
- We have splitted `Offset` into `Offset` and `OffsetState` (name
changes in consideration). The former is used to construct and convert
local or UTC date, and the latter is used to store the UTC offset
inside constructed values. Some offsets are their own states as well.
- This uses lots of associated types which implementation is still in
flux. Currently it crashes with debuginfo enabled. We've temporarily
disabled debuginfo from `Cargo.toml`.
- This technically allows a conversion to the local time, but not yet
tested.
also, previously `Numeric::Nanosecond` had a special left-aligned
parsing behavior. this commit replaces that with a newly designated
`Fixed::Nanosecond` which also handles an empty string which is
possible with an integral number of seconds.
this is most importantly required for negative years in `Parsed`,
which the current parser doesn't generate but is nevertheless
possible in principle. also updates tests for new fields.