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.
This commit is contained in:
parent
e9401d9266
commit
04fd1413a8
|
@ -1,23 +1,30 @@
|
|||
Chrono is mainly written by Kang Seonghoon <public+rust@mearie.org>,
|
||||
and also the following people (in ascending order):
|
||||
|
||||
Alex Mikhalev <alexmikhalevalex@gmail.com>
|
||||
Alexander Bulaev <alexbool@yandex-team.ru>
|
||||
Ashley Mannix <ashleymannix@live.com.au>
|
||||
Ben Eills <ben@beneills.com>
|
||||
Brandon W Maister <bwm@knewton.com>
|
||||
Colin Ray <r.colinray@gmail.com>
|
||||
Corey Farwell <coreyf@rwell.org>
|
||||
Dan <dan@ebip.co.uk>
|
||||
Danilo Bargen <mail@dbrgn.ch>
|
||||
David Hewson <dev@daveid.co.uk>
|
||||
David Ross <daboross@daboross.net>
|
||||
David Tolnay <dtolnay@gmail.com>
|
||||
David Willie <david.willie.1@gmail.com>
|
||||
Eunchong Yu <kroisse@gmail.com>
|
||||
Huon Wilson <dbau.pp+github@gmail.com>
|
||||
Jim Turner <jturner314@gmail.com>
|
||||
Jisoo Park <xxxyel@gmail.com>
|
||||
Joe Wilm <joe@jwilm.com>
|
||||
John Heitmann <jheitmann@gmail.com>
|
||||
John Nagle <nagle@sitetruth.com>
|
||||
János Illés <ijanos@gmail.com>
|
||||
Ken Tossell <ken@tossell.net>
|
||||
Martin Risell Lilja <martin.risell.lilja@gmail.com>
|
||||
Richard Petrie <rap1011@ksu.edu>
|
||||
Ryan Lewis <ryansname@gmail.com>
|
||||
Sergey V. Galtsev <sergey.v.galtsev@github.com>
|
||||
Steve Klabnik <steve@steveklabnik.com>
|
||||
|
|
10
Cargo.toml
10
Cargo.toml
|
@ -4,14 +4,18 @@ version = "0.2.25"
|
|||
authors = ["Kang Seonghoon <public+rust@mearie.org>"]
|
||||
|
||||
description = "Date and time library for Rust"
|
||||
homepage = "https://github.com/lifthrasiir/rust-chrono"
|
||||
documentation = "https://lifthrasiir.github.io/rust-chrono/"
|
||||
repository = "https://github.com/lifthrasiir/rust-chrono"
|
||||
homepage = "https://github.com/chronotope/chrono"
|
||||
documentation = "https://docs.rs/chrono/"
|
||||
repository = "https://github.com/chronotope/chrono"
|
||||
keywords = ["date", "time", "calendar"]
|
||||
categories = ["date-and-time"]
|
||||
readme = "README.md"
|
||||
license = "MIT/Apache-2.0"
|
||||
|
||||
[badges]
|
||||
travis-ci = { repository = "chronotope/chrono" }
|
||||
appveyor = { repository = "chronotope/chrono" }
|
||||
|
||||
[lib]
|
||||
name = "chrono"
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
Rust-chrono is dual-licensed under The MIT License [1] and
|
||||
Apache 2.0 License [2]. Copyright (c) 2014, Kang Seonghoon.
|
||||
Apache 2.0 License [2]. Copyright (c) 2014--2017, Kang Seonghoon and
|
||||
contributors.
|
||||
|
||||
Nota Bene: This is same as the Rust Project's own license.
|
||||
|
||||
|
|
18
Makefile
18
Makefile
|
@ -24,28 +24,28 @@ README.md: src/lib.rs
|
|||
echo '[![Chrono on Appveyor][appveyor-image]][appveyor]' >> $@
|
||||
echo '[![Chrono on crates.io][cratesio-image]][cratesio]' >> $@
|
||||
echo >> $@
|
||||
echo '[travis-image]: https://travis-ci.org/lifthrasiir/rust-chrono.svg?branch=master' >> $@
|
||||
echo '[travis]: https://travis-ci.org/lifthrasiir/rust-chrono' >> $@
|
||||
echo '[appveyor-image]: https://ci.appveyor.com/api/projects/status/o83jn08389si56fy/branch/master?svg=true' >> $@
|
||||
echo '[appveyor]: https://ci.appveyor.com/project/lifthrasiir/rust-chrono/branch/master' >> $@
|
||||
echo '[travis-image]: https://travis-ci.org/chronotope/chrono.svg?branch=master' >> $@
|
||||
echo '[travis]: https://travis-ci.org/chronotope/chrono' >> $@
|
||||
echo '[appveyor-image]: https://ci.appveyor.com/api/projects/status/2ia91ofww4w31m2w/branch/master?svg=true' >> $@
|
||||
echo '[appveyor]: https://ci.appveyor.com/project/chronotope/chrono' >> $@
|
||||
echo '[cratesio-image]: https://img.shields.io/crates/v/chrono.svg' >> $@
|
||||
echo '[cratesio]: https://crates.io/crates/chrono' >> $@
|
||||
awk '/^\/\/! # Chrono /,/^\/\/! ## /' $< | cut -b 5- | grep -v '^#' | \
|
||||
sed 's/](\.\//](https:\/\/lifthrasiir.github.io\/rust-chrono\/chrono\//g' >> $@
|
||||
sed 's/](\.\//](https:\/\/docs.rs\/chrono\/'"$$(cargo pkgid | cut -d: -f3)"'\/chrono\//g' >> $@
|
||||
echo '***[Complete Documentation][doc]***' >> $@
|
||||
echo >> $@
|
||||
echo '[doc]: https://lifthrasiir.github.io/rust-chrono/' >> $@
|
||||
echo '[doc]: https://docs.rs/chrono/'"$$(cargo pkgid | cut -d: -f3)"'/' >> $@
|
||||
echo >> $@
|
||||
awk '/^\/\/! ## /,!/^\/\/!/' $< | cut -b 5- | grep -v '^# ' | \
|
||||
sed 's/](\.\//](https:\/\/lifthrasiir.github.io\/rust-chrono\/chrono\//g' >> $@
|
||||
sed 's/](\.\//](https:\/\/docs.rs\/chrono\/'"$$(cargo pkgid | cut -d: -f3)"'\/chrono\//g' >> $@
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
cargo test --features 'serde rustc-serialize'
|
||||
cargo test --features 'serde rustc-serialize bincode'
|
||||
|
||||
.PHONY: doc
|
||||
doc: authors readme
|
||||
cargo doc --features 'serde rustc-serialize'
|
||||
cargo doc --features 'serde rustc-serialize bincode'
|
||||
|
||||
.PHONY: doc-publish
|
||||
doc-publish: doc
|
||||
|
|
78
README.md
78
README.md
|
@ -5,10 +5,10 @@
|
|||
[![Chrono on Appveyor][appveyor-image]][appveyor]
|
||||
[![Chrono on crates.io][cratesio-image]][cratesio]
|
||||
|
||||
[travis-image]: https://travis-ci.org/lifthrasiir/rust-chrono.svg?branch=master
|
||||
[travis]: https://travis-ci.org/lifthrasiir/rust-chrono
|
||||
[appveyor-image]: https://ci.appveyor.com/api/projects/status/o83jn08389si56fy/branch/master?svg=true
|
||||
[appveyor]: https://ci.appveyor.com/project/lifthrasiir/rust-chrono/branch/master
|
||||
[travis-image]: https://travis-ci.org/chronotope/chrono.svg?branch=master
|
||||
[travis]: https://travis-ci.org/chronotope/chrono
|
||||
[appveyor-image]: https://ci.appveyor.com/api/projects/status/2ia91ofww4w31m2w/branch/master?svg=true
|
||||
[appveyor]: https://ci.appveyor.com/project/chronotope/chrono
|
||||
[cratesio-image]: https://img.shields.io/crates/v/chrono.svg
|
||||
[cratesio]: https://crates.io/crates/chrono
|
||||
|
||||
|
@ -31,7 +31,7 @@ which Chrono builts upon and should acknowledge:
|
|||
|
||||
***[Complete Documentation][doc]***
|
||||
|
||||
[doc]: https://lifthrasiir.github.io/rust-chrono/
|
||||
[doc]: https://docs.rs/chrono/0.2.25/
|
||||
|
||||
## Usage
|
||||
|
||||
|
@ -61,16 +61,18 @@ extern crate chrono;
|
|||
|
||||
### Duration
|
||||
|
||||
[**`Duration`**](https://lifthrasiir.github.io/rust-chrono/chrono/struct.Duration.html)
|
||||
represents the magnitude of a time span. `Duration` used to be provided by Chrono.
|
||||
It has been moved to the `time` crate as the
|
||||
[`time::Duration`](https://doc.rust-lang.org/time/time/struct.Duration.html) type, but is
|
||||
still re-exported from Chrono.
|
||||
[**`Duration`**](https://docs.rs/chrono/0.2.25/chrono/struct.Duration.html) represents the magnitude of a time
|
||||
span. Note that this is an "accurate" duration represented as seconds and
|
||||
nanoseconds and does not represent "nominal" components such as days or
|
||||
months. `Duration` used to be provided by Chrono. It has been moved to the
|
||||
`time` crate as the
|
||||
[`time::Duration`](https://doc.rust-lang.org/time/time/struct.Duration.html)
|
||||
type, but is still re-exported from Chrono.
|
||||
|
||||
### Date and Time
|
||||
|
||||
Chrono provides a
|
||||
[**`DateTime`**](https://lifthrasiir.github.io/rust-chrono/chrono/datetime/struct.DateTime.html)
|
||||
[**`DateTime`**](https://docs.rs/chrono/0.2.25/chrono/datetime/struct.DateTime.html)
|
||||
type to represent a date and a time in a timezone.
|
||||
|
||||
For more abstract moment-in-time tracking such as internal timekeeping
|
||||
|
@ -81,15 +83,15 @@ which tracks your system clock, or
|
|||
is an opaque but monotonically-increasing representation of a moment in time.
|
||||
|
||||
`DateTime` is timezone-aware and must be constructed from
|
||||
the [**`TimeZone`**](https://lifthrasiir.github.io/rust-chrono/chrono/offset/trait.TimeZone.html) object,
|
||||
the [**`TimeZone`**](https://docs.rs/chrono/0.2.25/chrono/offset/trait.TimeZone.html) object,
|
||||
which defines how the local date is converted to and back from the UTC date.
|
||||
There are three well-known `TimeZone` implementations:
|
||||
|
||||
* [**`UTC`**](https://lifthrasiir.github.io/rust-chrono/chrono/offset/utc/struct.UTC.html) specifies the UTC time zone. It is most efficient.
|
||||
* [**`UTC`**](https://docs.rs/chrono/0.2.25/chrono/offset/utc/struct.UTC.html) specifies the UTC time zone. It is most efficient.
|
||||
|
||||
* [**`Local`**](https://lifthrasiir.github.io/rust-chrono/chrono/offset/local/struct.Local.html) specifies the system local time zone.
|
||||
* [**`Local`**](https://docs.rs/chrono/0.2.25/chrono/offset/local/struct.Local.html) specifies the system local time zone.
|
||||
|
||||
* [**`FixedOffset`**](https://lifthrasiir.github.io/rust-chrono/chrono/offset/fixed/struct.FixedOffset.html) specifies
|
||||
* [**`FixedOffset`**](https://docs.rs/chrono/0.2.25/chrono/offset/fixed/struct.FixedOffset.html) specifies
|
||||
an arbitrary, fixed time zone such as UTC+09:00 or UTC-10:30.
|
||||
This often results from the parsed textual date and time.
|
||||
Since it stores the most information and does not depend on the system environment,
|
||||
|
@ -97,12 +99,12 @@ There are three well-known `TimeZone` implementations:
|
|||
|
||||
`DateTime`s with different `TimeZone` types are distinct and do not mix,
|
||||
but can be converted to each other using
|
||||
the [`DateTime::with_timezone`](https://lifthrasiir.github.io/rust-chrono/chrono/datetime/struct.DateTime.html#method.with_timezone) method.
|
||||
the [`DateTime::with_timezone`](https://docs.rs/chrono/0.2.25/chrono/datetime/struct.DateTime.html#method.with_timezone) method.
|
||||
|
||||
You can get the current date and time in the UTC time zone
|
||||
([`UTC::now()`](https://lifthrasiir.github.io/rust-chrono/chrono/offset/utc/struct.UTC.html#method.now))
|
||||
([`UTC::now()`](https://docs.rs/chrono/0.2.25/chrono/offset/utc/struct.UTC.html#method.now))
|
||||
or in the local time zone
|
||||
([`Local::now()`](https://lifthrasiir.github.io/rust-chrono/chrono/offset/local/struct.Local.html#method.now)).
|
||||
([`Local::now()`](https://docs.rs/chrono/0.2.25/chrono/offset/local/struct.Local.html#method.now)).
|
||||
|
||||
~~~~ {.rust}
|
||||
use chrono::*;
|
||||
|
@ -142,8 +144,8 @@ assert_eq!(dt, fixed_dt);
|
|||
~~~~
|
||||
|
||||
Various properties are available to the date and time, and can be altered individually.
|
||||
Most of them are defined in the traits [`Datelike`](https://lifthrasiir.github.io/rust-chrono/chrono/trait.Datelike.html) and
|
||||
[`Timelike`](https://lifthrasiir.github.io/rust-chrono/chrono/trait.Timelike.html) which you should `use` before.
|
||||
Most of them are defined in the traits [`Datelike`](https://docs.rs/chrono/0.2.25/chrono/trait.Datelike.html) and
|
||||
[`Timelike`](https://docs.rs/chrono/0.2.25/chrono/trait.Timelike.html) which you should `use` before.
|
||||
Addition and subtraction is also supported.
|
||||
The following illustrates most supported operations to the date and time:
|
||||
|
||||
|
@ -181,14 +183,14 @@ assert_eq!(UTC.ymd(1970, 1, 1).and_hms(0, 0, 0) - Duration::seconds(1_000_000_00
|
|||
UTC.ymd(1938, 4, 24).and_hms(22, 13, 20));
|
||||
~~~~
|
||||
|
||||
Formatting is done via the [`format`](https://lifthrasiir.github.io/rust-chrono/chrono/datetime/struct.DateTime.html#method.format) method,
|
||||
Formatting is done via the [`format`](https://docs.rs/chrono/0.2.25/chrono/datetime/struct.DateTime.html#method.format) method,
|
||||
which format is equivalent to the familiar `strftime` format.
|
||||
(See the [`format::strftime` module documentation](https://lifthrasiir.github.io/rust-chrono/chrono/format/strftime/index.html#specifiers)
|
||||
(See the [`format::strftime` module documentation](https://docs.rs/chrono/0.2.25/chrono/format/strftime/index.html#specifiers)
|
||||
for full syntax.)
|
||||
|
||||
The default `to_string` method and `{:?}` specifier also give a reasonable representation.
|
||||
Chrono also provides [`to_rfc2822`](https://lifthrasiir.github.io/rust-chrono/chrono/datetime/struct.DateTime.html#method.to_rfc2822) and
|
||||
[`to_rfc3339`](https://lifthrasiir.github.io/rust-chrono/chrono/datetime/struct.DateTime.html#method.to_rfc3339) methods
|
||||
Chrono also provides [`to_rfc2822`](https://docs.rs/chrono/0.2.25/chrono/datetime/struct.DateTime.html#method.to_rfc2822) and
|
||||
[`to_rfc3339`](https://docs.rs/chrono/0.2.25/chrono/datetime/struct.DateTime.html#method.to_rfc3339) methods
|
||||
for well-known formats.
|
||||
|
||||
~~~~ {.rust}
|
||||
|
@ -214,23 +216,23 @@ Parsing can be done with three methods:
|
|||
([`std::fmt::Debug`](https://doc.rust-lang.org/std/fmt/trait.Debug.html))
|
||||
format specifier prints, and requires the offset to be present.
|
||||
|
||||
2. [`DateTime::parse_from_str`](https://lifthrasiir.github.io/rust-chrono/chrono/datetime/struct.DateTime.html#method.parse_from_str) parses
|
||||
2. [`DateTime::parse_from_str`](https://docs.rs/chrono/0.2.25/chrono/datetime/struct.DateTime.html#method.parse_from_str) parses
|
||||
a date and time with offsets and returns `DateTime<FixedOffset>`.
|
||||
This should be used when the offset is a part of input and the caller cannot guess that.
|
||||
It *cannot* be used when the offset can be missing.
|
||||
[`DateTime::parse_from_rfc2822`](https://lifthrasiir.github.io/rust-chrono/chrono/datetime/struct.DateTime.html#method.parse_from_rfc2822)
|
||||
[`DateTime::parse_from_rfc2822`](https://docs.rs/chrono/0.2.25/chrono/datetime/struct.DateTime.html#method.parse_from_rfc2822)
|
||||
and
|
||||
[`DateTime::parse_from_rfc3339`](https://lifthrasiir.github.io/rust-chrono/chrono/datetime/struct.DateTime.html#method.parse_from_rfc3339)
|
||||
[`DateTime::parse_from_rfc3339`](https://docs.rs/chrono/0.2.25/chrono/datetime/struct.DateTime.html#method.parse_from_rfc3339)
|
||||
are similar but for well-known formats.
|
||||
|
||||
3. [`Offset::datetime_from_str`](https://lifthrasiir.github.io/rust-chrono/chrono/offset/trait.TimeZone.html#method.datetime_from_str) is
|
||||
3. [`Offset::datetime_from_str`](https://docs.rs/chrono/0.2.25/chrono/offset/trait.TimeZone.html#method.datetime_from_str) is
|
||||
similar but returns `DateTime` of given offset.
|
||||
When the explicit offset is missing from the input, it simply uses given offset.
|
||||
It issues an error when the input contains an explicit offset different
|
||||
from the current offset.
|
||||
|
||||
More detailed control over the parsing process is available via
|
||||
[`format`](https://lifthrasiir.github.io/rust-chrono/chrono/format/index.html) module.
|
||||
[`format`](https://docs.rs/chrono/0.2.25/chrono/format/index.html) module.
|
||||
|
||||
~~~~ {.rust}
|
||||
use chrono::*;
|
||||
|
@ -264,7 +266,7 @@ assert!(UTC.datetime_from_str("Sat Nov 28 12:00:09 2014", "%a %b %e %T %Y").is_e
|
|||
|
||||
### Individual date
|
||||
|
||||
Chrono also provides an individual date type ([**`Date`**](https://lifthrasiir.github.io/rust-chrono/chrono/date/struct.Date.html)).
|
||||
Chrono also provides an individual date type ([**`Date`**](https://docs.rs/chrono/0.2.25/chrono/date/struct.Date.html)).
|
||||
It also has time zones attached, and have to be constructed via time zones.
|
||||
Most operations available to `DateTime` are also available to `Date` whenever appropriate.
|
||||
|
||||
|
@ -282,26 +284,26 @@ assert_eq!(UTC.ymd(2014, 11, 28).and_hms_milli(7, 8, 9, 10).format("%H%M%S").to_
|
|||
|
||||
There is no timezone-aware `Time` due to the lack of usefulness and also the complexity.
|
||||
|
||||
`DateTime` has [`date`](https://lifthrasiir.github.io/rust-chrono/chrono/datetime/struct.DateTime.html#method.date) method
|
||||
`DateTime` has [`date`](https://docs.rs/chrono/0.2.25/chrono/datetime/struct.DateTime.html#method.date) method
|
||||
which returns a `Date` which represents its date component.
|
||||
There is also a [`time`](https://lifthrasiir.github.io/rust-chrono/chrono/datetime/struct.DateTime.html#method.time) method,
|
||||
There is also a [`time`](https://docs.rs/chrono/0.2.25/chrono/datetime/struct.DateTime.html#method.time) method,
|
||||
which simply returns a naive local time described below.
|
||||
|
||||
### Naive date and time
|
||||
|
||||
Chrono provides naive counterparts to `Date`, (non-existent) `Time` and `DateTime`
|
||||
as [**`NaiveDate`**](https://lifthrasiir.github.io/rust-chrono/chrono/naive/date/struct.NaiveDate.html),
|
||||
[**`NaiveTime`**](https://lifthrasiir.github.io/rust-chrono/chrono/naive/time/struct.NaiveTime.html) and
|
||||
[**`NaiveDateTime`**](https://lifthrasiir.github.io/rust-chrono/chrono/naive/datetime/struct.NaiveDateTime.html) respectively.
|
||||
as [**`NaiveDate`**](https://docs.rs/chrono/0.2.25/chrono/naive/date/struct.NaiveDate.html),
|
||||
[**`NaiveTime`**](https://docs.rs/chrono/0.2.25/chrono/naive/time/struct.NaiveTime.html) and
|
||||
[**`NaiveDateTime`**](https://docs.rs/chrono/0.2.25/chrono/naive/datetime/struct.NaiveDateTime.html) respectively.
|
||||
|
||||
They have almost equivalent interfaces as their timezone-aware twins,
|
||||
but are not associated to time zones obviously and can be quite low-level.
|
||||
They are mostly useful for building blocks for higher-level types.
|
||||
|
||||
Timezone-aware `DateTime` and `Date` types have two methods returning naive versions:
|
||||
[`naive_local`](https://lifthrasiir.github.io/rust-chrono/chrono/datetime/struct.DateTime.html#method.naive_local) returns
|
||||
[`naive_local`](https://docs.rs/chrono/0.2.25/chrono/datetime/struct.DateTime.html#method.naive_local) returns
|
||||
a view to the naive local time,
|
||||
and [`naive_utc`](https://lifthrasiir.github.io/rust-chrono/chrono/datetime/struct.DateTime.html#method.naive_utc) returns
|
||||
and [`naive_utc`](https://docs.rs/chrono/0.2.25/chrono/datetime/struct.DateTime.html#method.naive_utc) returns
|
||||
a view to the naive UTC time.
|
||||
|
||||
## Limitations
|
||||
|
@ -313,7 +315,7 @@ Date types are limited in about +/- 262,000 years from the common epoch.
|
|||
Time types are limited in the nanosecond accuracy.
|
||||
|
||||
[Leap seconds are supported in the representation but
|
||||
Chrono doesn't try to make use of them](https://lifthrasiir.github.io/rust-chrono/chrono/naive/time/index.html#leap-second-handling).
|
||||
Chrono doesn't try to make use of them](https://docs.rs/chrono/0.2.25/chrono/naive/time/index.html#leap-second-handling).
|
||||
(The main reason is that leap seconds are not really predictable.)
|
||||
Almost *every* operation over the possible leap seconds will ignore them.
|
||||
Consider using `NaiveDateTime` with the implicit TAI (International Atomic Time) scale
|
||||
|
|
|
@ -322,7 +322,7 @@
|
|||
//!
|
||||
//! Advanced time zone handling is not yet supported (but is planned in 0.3).
|
||||
|
||||
#![doc(html_root_url = "https://lifthrasiir.github.io/rust-chrono/")]
|
||||
#![doc(html_root_url = "https://docs.rs/chrono/0.2.25/")]
|
||||
|
||||
#![cfg_attr(bench, feature(test))] // lib stability features as per RFC #507
|
||||
#![deny(missing_docs)]
|
||||
|
|
Loading…
Reference in New Issue