Commit Graph

92 Commits

Author SHA1 Message Date
Alejandro Fernández 4b2a287776
Update broken links to `time::Duration` 2018-08-06 20:41:02 +02:00
Brandon W Maister 66005be6a2
Fix position of gitter badge. 2018-04-19 23:28:09 -04:00
The Gitter Badger c2753f1158 Add Gitter badge 2018-04-20 03:23:21 +00:00
Brandon W Maister a060684abe
Merge pull request #174 from quodlibetor/deprecated-warnings-for-rustc_serialize
Deprecated warnings in cargo output for rustc-serialize feature
2018-04-03 05:52:58 -07:00
Brandon W Maister ba1b88ecbc Remove version number from README 2018-04-01 20:08:47 -04:00
skierpage 21d302f0d2
Update version number to 0.4.1
cargo.toml and crates.io are at 0.4.1. I don't know if you want to update the docs link and sample `Cargo.toml` lines.
2018-04-01 17:02:32 -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
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
Kang Seonghoon fe529c8016
0.4.0: Mass renaming, `IsoWeek`, `SystemTime` supports, serde utils.
Starting from this version the `CHANGELOG.md` file is the canonical
source for the list of significant changes. See the file for details.

Fixes #146.
Fixes #159.
2017-06-22 02:59:46 +09:00
Kang Seonghoon 7b9b0c4437
Renamed `chrono::UTC` to `chrono::Utc`.
Fixes #148.
2017-06-22 00:33:17 +09:00
Kang Seonghoon c06bc01f0b
Flattened intermediate implementation modules.
There used to be multiple modules like `chrono::datetime` which only
provide a single type `DateTime`. In retrospect, this module structure
never reflected how people use those types; with the release of 0.3.0
`chrono::prelude` is a preferred way to glob-import types, and due to
reexports `chrono::DateTime` and likes are also common enough.

Therefore this commit removes those implementation modules and
flattens the module structure. Specifically:

    Before                              After
    ----------------------------------  ----------------------------
    chrono:📅:Date                  chrono::Date
    chrono:📅:MIN                   chrono::MIN_DATE
    chrono:📅:MAX                   chrono::MAX_DATE
    chrono::datetime::DateTime          chrono::DateTime
    chrono::datetime::TsSeconds         chrono::TsSeconds
    chrono::datetime::serde::*          chrono::serde::*
    chrono::naive::time::NaiveTime      chrono::naive::NaiveTime
    chrono::naive:📅:NaiveDate      chrono::naive::NaiveDate
    chrono::naive:📅:MIN            chrono::naive::MIN_DATE
    chrono::naive:📅:MAX            chrono::naive::MAX_DATE
    chrono::naive::datetime::NaiveDateTime
                                        chrono::naive::NaiveDateTime
    chrono::naive::datetime::TsSeconds  chrono::naive::TsSeconds
    chrono::naive::datetime::serde::*   chrono::naive::serde::*
    chrono::offset::utc::UTC            chrono::offset::UTC
    chrono::offset::fixed::FixedOffset  chrono::offset::FixedOffset
    chrono::offset::local::Local        chrono::offset::Local
    chrono::format::parsed::Parsed      chrono::format::Parsed

All internal documentation links have been updated (phew!) and
verified with LinkChecker [1]. Probably we can automate this check
in the future.

[1] https://wummel.github.io/linkchecker/

Closes #161. Compared to the original proposal, `chrono::naive` is
retained as we had `TsSeconds` types duplicated for `NaiveDateTime`
and `DateTime` (legitimately).
2017-06-21 14:03:49 +09:00
Kang Seonghoon 388c04002b
Bumped the version number. This marks the beginning of 0.4.0 series.
- Added a mention to Chrono-tz.
2017-06-21 03:27:46 +09:00
Kang Seonghoon 52de957c60
I forgot to update the README and docs link (whoops).
Fixes #149.
2017-05-11 01:50:19 +09:00
Frans Skarman 5d07a5d9c1 Update code snippets to use syntax highlighting 2017-04-10 22:24:32 +02:00
Eric Findlay 3d36feb234 Corrected spelling error 2017-02-20 16:04:32 +09:00
Kang Seonghoon db9b98f691
0.3.0: Planned breaking changes to the existing interface.
So this is a much delayed major release, but this should not really
change how you use Chrono---only the "required" breakages have been
done (e.g. anything hindering API evolution). The "big" release used to
be 0.3, but due to the dependency changes we are forced to push that to
0.4. I've took this opportunity to push all known planned breaking
changes to 0.3, so this should be quite stable for a moment.

See `CHANGELOG.md` for the full list of changes, but most importantly:

- `chrono::prelude` module has been added for proper glob imports.

- `FixedOffset` is now the official "value" type for time zone offsets.

- Serde 0.9 support has landed, and serialization format used by
  rustc-serialize and Serde has been now synchronized.

- Formatting items have been slightly adjusted to be future-proof.

Fixes #126.
2017-02-07 05:52:07 +09:00
Kang Seonghoon 0ac41c70b1
Minor additions to formatting items.
- Formatting item types are no longer `Copy`.

- `Numeric` and `Fixed` items now have `Internal` variants reserved
  for the future expansion. It had been hard to expand the items
  without totally breaking the backward compatibility (as per
  the API evolution guideline of RFC 1105).

- `Item::Owned{Literal,Space}` for the owned variant of
  `Item::{Literal,Space}` has been added.

Closes #76.
2017-02-07 04:05:05 +09:00
Kang Seonghoon c63ef14734
`time::Duration` is no longer the sole duration type described.
Due to the backward compatibility we won't be going to remove support
for `time::Duration` in 0.3, and the initial 0.3.0 release won't have
proper `std::time::Duration` support (haven't finalized the logics).
However we will reserve proper names and signatures for the upcoming
`std::time::Duration` support---the "older" duration type will be
referred as "signed" in the names.

- Added a `chrono::prelude` module. This does not have the (old)
  `Duration` type reexported, so the documentation has now correctly
  replaced all occurrences of `chrono::Duration`. The existing
  `chrono::Duration` reexport itself remains for the compatibility.

- Avoided using a plain `Duration` type in the signature, to avoid
  any ambiguity.

- Renamed `checked_{add,sub}` to `checked_{add,sub}_signed`.

- Subtraction operator between two instants has been removed and
  replaced with `signed_duration_since`. This follows the naming
  chosen by `std::time::SystemTime` etc., and the version for newer
  `std::time::Duration` will be named to `duration_since`.
2017-02-06 09:39:32 +09:00
Kang Seonghoon de4df91421
Removed all remaining mentions of rust-chrono (very old name). 2017-02-06 06:15:57 +09:00
Kang Seonghoon 04fd1413a8
Chrono is now under the Chronotope org; switch to docs.rs.
All CI accounts are now moved to the new organization (unfortunately
Appveyor does not automatically move the build history though).

Since it's a mess to redirect everything to chronotope.github.io,
I've taken this as an opportunity to switch to docs.rs---this seems
to be better than the manual management nowadays.

Updated other files as accordingly.
2017-02-06 05:49:32 +09:00
Kang Seonghoon 8aa1f4b7af
Further tweaks to CI configs.
- Do not doc-test three times in Travis, it simply takes a lot :(

- Forgot that Windows shell doesn't recognize single quotes.
2016-08-17 03:18:12 +09:00
Kang Seonghoon eda83ac3d9
Tweaked Travis settings and tried to enable Appveyor CI. 2016-08-17 03:05:44 +09:00
Kang Seonghoon cb9fd7fbe1 0.2.25: Fixed warnings from 0.2.24. Duh. 2016-08-04 03:44:31 +09:00
Kang Seonghoon 603ac1bc1c 0.2.24: Serialization updates.
- Serde 0.8 is now supported. (#86)

- The deserialization implementation for rustc-serialize now properly
  verifies the input. Also tons of tests have been added. (#42)
2016-08-04 03:37:33 +09:00
Kang Seonghoon ae9be4a6f3 0.2.23: Documentation and minor bug fixes.
- Tons of documentation updates! (#77, #78, #80, #82 and my own
  changes as well)

- `DateTime::timestamp_subsec_{millis,micros,nanos}` methods have
  been added. (#81)

- When the system time records a leap second,
  the nanosecond component was mistakenly reset to zero. (#84)

- `Local` offset misbehaves in Windows for August and later,
  due to the long-standing libtime bug (dates back to mid-2015).
  Workaround has been implemented. (#85)
2016-08-03 01:18:33 +09:00
Kang Seonghoon 932e29aa94 Better documentation and cross-references for naive types. 2016-08-01 01:02:32 +09:00
Kang Seonghoon f41de9b41f Documentation cleanup.
- The main documentation (`src/lib.rs` AND `README.md`) now properly
  link to other types when rendered.

- The role of `TimeZone` trait is explained more thoroughly.

(Hopefully) fixes #82.
2016-07-26 03:48:08 +09:00
David Willie c631ba3767 Clarify serde support inclusion in readme.md 2016-06-22 14:51:18 +10:00
Kang Seonghoon 7bfb92711d Merge pull request #78 from JohnHeitmann/patch-2
Minor DateTime intro doc update
2016-06-15 01:59:59 +09:00
John Heitmann 531aa752b3 Minor DateTime intro doc update
• Put timezone in the lede since it's critical.
• Mention Instant and SystemTime to put DateTime in context
2016-06-13 21:20:21 -07:00
John Heitmann dce4ddf592 Clean up Duration intro doc
• Make what Duration is the first thing mentioned instead of project history.
• Add "magnitude" to the description to disambiguate it from Interval (in the Joda sense).
• Brush up some awkward language.
• Add a doc link and illustrate the module namespace.
2016-06-13 21:03:52 -07:00
Kang Seonghoon 8efc85ce9f 0.2.22: Fixes on `%.6f` and `%.9f` on whole seconds.
- `%.6f` and `%.9f` used to print only three digits
  when the nanosecond part is zero. (#71)

- The documentation for `%+` has been updated
  to reflect the current status. (#71)
2016-04-22 08:54:57 +09:00
Kang Seonghoon d869643a33 0.2.21: a slight bug fix.
- `Fixed::LongWeekdayName` was unable to recognize `"sunday"`. (#66)
- Slight documentation addition. (#65)
2016-03-29 09:00:49 +09:00
Kang Seonghoon 530a5ee10b 0.2.20: Updated `serde` dependency. (#63, #64) 2016-03-06 00:19:29 +09:00
Kang Seonghoon aa6df02436 0.2.19: `DateTime::date` (and indirectly, `Local::today`) fix. (#61) 2016-02-05 01:35:43 +09:00
kud1ing 458f09270d "time" is now "https://github.com/rust-lang-deprecated/time" 2016-01-28 08:14:03 +01:00
Kang Seonghoon d789e3e493 0.2.18: Get rid of a superfluous `rand` dependency. (#57) 2016-01-23 14:41:12 +09:00
Kang Seonghoon d3384780d0 rustfmt'ed src/lib.rs (only). 2016-01-23 14:37:29 +09:00
Kang Seonghoon 2c11364410 0.2.17: Added a serde support for date and time types. (#51) 2015-11-22 03:27:08 +09:00
Kang Seonghoon ed3727931f 0.2.16: mainly maintenance changes, with a minor formatting addition.
- Added `%.3f`, `%.6f` and `%.9f` specifier for formatting fractional seconds
  up to 3, 6 or 9 decimal digits. This is a natural extension to the existing `%f`.
  Note that this is (not yet) generic, no other value of precision is supported. (#45)

- Forbade unsized types from implementing `Datelike` and `Timelike`.
  This does not make a big harm as any type implementing them should be already sized
  to be practical, but this change still can break highly generic codes. (#46)

- Fixed a broken link in the `README.md`. (#41)

- Tons of supporting examples for the documentation have been added. More to come.
2015-09-06 21:46:03 +09:00
Kang Seonghoon 68f45dae75 Fix a link in the README.
Fixes #41.
2015-08-08 13:09:44 +09:00
Kang Seonghoon 01b3ed2ada 0.2.15: more formatting specifiers and documentation fixes.
- Added padding modifiers `%_?`, `%-?` and `%0?`.

- Added new specifiers `%:z` and `%.f`.

- When `%s` specifier is used with a time zone, the time zone offset was
  ignored. This has been fixed.

- Several documentation fixes including the misleading presence of
  colons in the `%z` specifier. `%:z` was introduced partly due to this.
2015-07-05 15:26:30 +09:00
Kang Seonghoon 0d6c3ce11a a couple of documentation fixes.
- We've got 1.0.0, so no need for version pinning now.

- `%Z` is formatting-only specifier but wasn't clearly documented.
  Fixes #38.
2015-05-25 10:12:11 +09:00
Kang Seonghoon 9cff70bd04 0.2.14: fixed a subtle bug in `Naive(Date)Time` addition.
- `NaiveDateTime +/- Duration` or `NaiveTime +/- Duration` could
  have gone wrong when the `Duration` to be added is negative and
  has a fractional second part.

  This was caused by an underflow in the conversion from `Duration`
  to the parts; the lack of tests for this case allowed a bug.
  A regression test has been added to avoid further bugs. (#37)
2015-05-15 02:20:03 +09:00
Kang Seonghoon e08f0849dc well, I forgot to update the README. 2015-04-29 02:12:17 +09:00
Kang Seonghoon 90ac81e9f9 0.2.13: beta stabilization and optional rustc_serialize deps.
- 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.
2015-04-29 02:09:04 +09:00
Kang Seonghoon 533161cfd7 0.2.12: language changes.
- 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.
2015-04-25 00:12:56 +09:00
Kang Seonghoon eced570882 0.2.11: language changes.
- 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.
2015-04-17 01:28:31 +09:00
Kang Seonghoon 7fd0cf124a 0.2.10: language changes.
- `Copy` requires `Clone`.
2015-04-05 03:18:49 +09:00