Backed out 2 changesets (bug 1492001) for Btup build bustages
authorNoemi Erli <nerli@mozilla.com>
Tue, 18 Sep 2018 20:38:24 +0300
changeset 495438 eacc5bdd4ab34fe95058dcb290fc7f64389a58eb
parent 495437 3a93dd337a0ebdd7b0e7e5bbe16c80529e99ae68
child 495439 d517652362dc57da1c1dd1089d31211254bccc81
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1492001
milestone64.0a1
backs out6ec9bc89a5b392867e0df66d192a2f73eb2d6776
238fdce77ee98b9a091f613a70fd2c1ad4e2e632
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 2 changesets (bug 1492001) for Btup build bustages Backed out changeset 6ec9bc89a5b3 (bug 1492001) Backed out changeset 238fdce77ee9 (bug 1492001)
Cargo.lock
testing/geckodriver/Cargo.toml
third_party/rust/chrono/.cargo-checksum.json
third_party/rust/chrono/.travis.yml
third_party/rust/chrono/AUTHORS.txt
third_party/rust/chrono/CHANGELOG.md
third_party/rust/chrono/Cargo.toml
third_party/rust/chrono/LICENSE.txt
third_party/rust/chrono/Makefile
third_party/rust/chrono/README.md
third_party/rust/chrono/appveyor.yml
third_party/rust/chrono/ci/fix-readme.sh
third_party/rust/chrono/ci/travis.sh
third_party/rust/chrono/src/date.rs
third_party/rust/chrono/src/datetime.rs
third_party/rust/chrono/src/div.rs
third_party/rust/chrono/src/format/mod.rs
third_party/rust/chrono/src/format/parse.rs
third_party/rust/chrono/src/format/parsed.rs
third_party/rust/chrono/src/format/scan.rs
third_party/rust/chrono/src/format/strftime.rs
third_party/rust/chrono/src/lib.rs
third_party/rust/chrono/src/naive/date.rs
third_party/rust/chrono/src/naive/datetime.rs
third_party/rust/chrono/src/naive/internals.rs
third_party/rust/chrono/src/naive/isoweek.rs
third_party/rust/chrono/src/naive/time.rs
third_party/rust/chrono/src/offset/fixed.rs
third_party/rust/chrono/src/offset/local.rs
third_party/rust/chrono/src/offset/mod.rs
third_party/rust/chrono/src/offset/utc.rs
third_party/rust/chrono/src/oldtime.rs
third_party/rust/chrono/src/round.rs
third_party/rust/num-integer/.cargo-checksum.json
third_party/rust/num-integer/.travis.yml
third_party/rust/num-integer/Cargo.toml
third_party/rust/num-integer/README.md
third_party/rust/num-integer/RELEASES.md
third_party/rust/num-integer/benches/roots.rs
third_party/rust/num-integer/bors.toml
third_party/rust/num-integer/build.rs
third_party/rust/num-integer/ci/rustup.sh
third_party/rust/num-integer/ci/test_full.sh
third_party/rust/num-integer/src/lib.rs
third_party/rust/num-integer/src/roots.rs
third_party/rust/num-integer/tests/roots.rs
third_party/rust/num-iter/.cargo-checksum.json
third_party/rust/num-iter/Cargo.toml
third_party/rust/num-iter/LICENSE-APACHE
third_party/rust/num-iter/LICENSE-MIT
third_party/rust/num-iter/src/lib.rs
third_party/rust/num-traits/.cargo-checksum.json
third_party/rust/num-traits/.travis.yml
third_party/rust/num-traits/Cargo.toml
third_party/rust/num-traits/README.md
third_party/rust/num-traits/RELEASES.md
third_party/rust/num-traits/build.rs
third_party/rust/num-traits/ci/rustup.sh
third_party/rust/num-traits/ci/test_full.sh
third_party/rust/num-traits/src/bounds.rs
third_party/rust/num-traits/src/cast.rs
third_party/rust/num-traits/src/float.rs
third_party/rust/num-traits/src/identities.rs
third_party/rust/num-traits/src/int.rs
third_party/rust/num-traits/src/lib.rs
third_party/rust/num-traits/src/macros.rs
third_party/rust/num-traits/src/ops/checked.rs
third_party/rust/num-traits/src/ops/inv.rs
third_party/rust/num-traits/src/ops/mod.rs
third_party/rust/num-traits/src/ops/mul_add.rs
third_party/rust/num-traits/src/ops/saturating.rs
third_party/rust/num-traits/src/ops/wrapping.rs
third_party/rust/num-traits/src/pow.rs
third_party/rust/num-traits/src/real.rs
third_party/rust/num-traits/src/sign.rs
third_party/rust/num-traits/tests/cast.rs
third_party/rust/num/.cargo-checksum.json
third_party/rust/num/.travis.yml
third_party/rust/num/Cargo.toml
third_party/rust/num/LICENSE-APACHE
third_party/rust/num/LICENSE-MIT
third_party/rust/num/README.md
third_party/rust/num/benches/bigint.rs
third_party/rust/num/benches/shootout-pidigits.rs
third_party/rust/num/bors.toml
third_party/rust/num/ci/deploy.enc
third_party/rust/num/ci/deploy.sh
third_party/rust/num/ci/rustup.sh
third_party/rust/num/ci/test_full.sh
third_party/rust/num/doc/favicon.ico
third_party/rust/num/doc/index.html
third_party/rust/num/doc/rust-logo-128x128-blk-v2.png
third_party/rust/num/src/lib.rs
third_party/rust/zip/.cargo-checksum.json
third_party/rust/zip/.travis.yml
third_party/rust/zip/Cargo.toml
third_party/rust/zip/README.md
third_party/rust/zip/appveyor.yml
third_party/rust/zip/examples/stdin_info.rs
third_party/rust/zip/src/compression.rs
third_party/rust/zip/src/crc32.rs
third_party/rust/zip/src/lib.rs
third_party/rust/zip/src/read.rs
third_party/rust/zip/src/types.rs
third_party/rust/zip/src/write.rs
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -28,17 +28,17 @@ dependencies = [
  "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "app_units"
 version = "0.7.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "arrayref"
 version = "0.3.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
@@ -289,21 +289,20 @@ dependencies = [
 
 [[package]]
 name = "cfg-if"
 version = "0.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "chrono"
-version = "0.4.6"
+version = "0.2.25"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
- "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
  "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "clang-sys"
 version = "0.23.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
@@ -699,17 +698,17 @@ name = "error-chain"
 version = "0.11.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "euclid"
 version = "0.19.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "failure"
 version = "0.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
@@ -826,45 +825,45 @@ dependencies = [
  "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "geckodriver"
 version = "0.22.0"
 dependencies = [
  "base64 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "chrono 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
  "clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "hyper 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "mozprofile 0.4.0",
  "mozrunner 0.8.0",
  "mozversion 0.1.3",
  "regex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_derive 1.0.66 (git+https://github.com/servo/serde?branch=deserialize_from_enums8)",
  "serde_json 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
  "uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "webdriver 0.37.0",
- "zip 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "zip 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "geckoservo"
 version = "0.0.1"
 dependencies = [
  "atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "cssparser 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "cstr 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "malloc_size_of 0.0.1",
  "nsstring 0.1.0",
- "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "parking_lot 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "selectors 0.20.0",
  "servo_arc 0.1.1",
  "smallvec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "style 0.0.1",
  "style_traits 0.0.1",
 ]
 
@@ -1415,31 +1414,31 @@ dependencies = [
 [[package]]
 name = "mp4parse"
 version = "0.10.1"
 dependencies = [
  "bitreader 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "mp4parse_fallible 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "mp4parse-gtest"
 version = "0.1.0"
 
 [[package]]
 name = "mp4parse_capi"
 version = "0.10.1"
 dependencies = [
  "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "mp4parse 0.10.1",
- "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "mp4parse_fallible"
 version = "0.0.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
@@ -1469,17 +1468,17 @@ dependencies = [
  "nsstring 0.1.0",
 ]
 
 [[package]]
 name = "new-ordered-float"
 version = "1.0.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "new_debug_unreachable"
 version = "1.0.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
@@ -1517,61 +1516,80 @@ dependencies = [
 [[package]]
 name = "nsstring-gtest"
 version = "0.1.0"
 dependencies = [
  "nsstring 0.1.0",
 ]
 
 [[package]]
+name = "num"
+version = "0.1.40"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
 name = "num-derive"
 version = "0.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "proc-macro2 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
  "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "syn 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "num-integer"
-version = "0.1.39"
+version = "0.1.35"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "num-iter"
+version = "0.1.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "num-traits"
 version = "0.1.43"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "num-traits"
-version = "0.2.6"
+version = "0.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "num_cpus"
 version = "1.7.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "ordered-float"
 version = "1.0.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "ordermap"
 version = "0.3.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
@@ -1663,17 +1681,17 @@ source = "registry+https://github.com/ru
 [[package]]
 name = "plane-split"
 version = "0.13.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "binary-space-partition 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "podio"
 version = "0.1.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
@@ -2114,18 +2132,18 @@ dependencies = [
  "lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "malloc_size_of 0.0.1",
  "malloc_size_of_derive 0.0.1",
  "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "nsstring 0.1.0",
  "num-derive 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
- "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "ordered-float 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "parking_lot 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "rayon 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "regex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "selectors 0.20.0",
@@ -2175,17 +2193,17 @@ dependencies = [
  "atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "cssparser 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "cstr 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "geckoservo 0.0.1",
  "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "malloc_size_of 0.0.1",
- "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "regex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "selectors 0.20.0",
  "size_of_test 0.0.1",
  "smallvec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "style 0.0.1",
  "style_traits 0.0.1",
 ]
 
@@ -2645,17 +2663,17 @@ dependencies = [
  "core-text 11.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "dwrote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "freetype 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "gleam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "plane-split 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rayon 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "ron 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
  "smallvec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "thread_profiler 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
  "webrender_api 0.57.2",
@@ -2803,17 +2821,17 @@ name = "yaml-rust"
 version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "zip"
-version = "0.4.2"
+version = "0.3.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "bzip2 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "msdos_time 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "podio 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -2843,17 +2861,17 @@ dependencies = [
 "checksum build_const 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e90dc84f5e62d2ebe7676b83c22d33b6db8bd27340fb6ffbff0a364efa0cb9c9"
 "checksum byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23"
 "checksum bytes 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e178b8e0e239e844b083d5a0d4a156b2654e67f9f80144d48398fcd736a24fb8"
 "checksum bzip2 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3eafc42c44e0d827de6b1c131175098fe7fb53b8ce8a47e65cb3ea94688be24"
 "checksum bzip2-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2c5162604199bbb17690ede847eaa6120a3f33d5ab4dcc8e7c25b16d849ae79b"
 "checksum cc 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)" = "c37f0efaa4b9b001fa6f02d4b644dee4af97d3414df07c51e3e4f015f3a3e131"
 "checksum cexpr 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "42aac45e9567d97474a834efdee3081b3c942b2205be932092f53354ce503d6c"
 "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
-"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878"
+"checksum chrono 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)" = "9213f7cd7c27e95c2b57c49f0e69b1ea65b27138da84a170133fd21b07659c00"
 "checksum clang-sys 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d7f7c04e52c35222fffcc3a115b5daf5f7e2bfb71c13c4e2321afe1fc71859c2"
 "checksum clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0f16b89cbb9ee36d87483dc939fe9f1e13c05898d56d7b230a0d4dff033a536"
 "checksum cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "56d741ea7a69e577f6d06b36b7dff4738f680593dc27a701ffa8506b73ce28bb"
 "checksum cookie 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1465f8134efa296b4c19db34d909637cb2bf0f7aaf21299e23e18fa29ac557cf"
 "checksum core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7caa6cb9e76ddddbea09a03266d6b3bc98cd41e9fb9b017c473e7cca593ec25"
 "checksum core-foundation-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b2a53cce0ddcf7e7e1f998738d757d5a3bf08bf799a180e50ebe50d298f52f5a"
 "checksum core-graphics 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92801c908ea6301ae619ed842a72e01098085fc321b9c2f3f833dad555bba055"
 "checksum core-text 11.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "157ff38a92496dc676ce36d9124554e9ac66f1c1039f952690ac64f71cfa5968"
@@ -2951,20 +2969,22 @@ dependencies = [
 "checksum moz_cbor 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20c82a57087fd5990d7122dbff1607c3b20c3d2958e9d9ad9765aab415e2c91c"
 "checksum mp4parse_fallible 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6626c2aef76eb8f984eef02e475883d3fe9112e114720446c5810fc5f045cd30"
 "checksum msdos_time 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aad9dfe950c057b1bfe9c1f2aa51583a8468ef2a5baba2ebbe06d775efeb7729"
 "checksum net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)" = "9044faf1413a1057267be51b5afba8eb1090bd2231c693664aa1db716fe1eae0"
 "checksum new-ordered-float 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8ccbebba6fb53a6d2bdcfaf79cb339bc136dee3bfff54dc337a334bafe36476a"
 "checksum new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0cdc457076c78ab54d5e0d6fa7c47981757f1e34dc39ff92787f217dede586c4"
 "checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2"
 "checksum nom 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05aec50c70fd288702bcd93284a8444607f3292dbdf2a30de5ea5dcdbe72287b"
+"checksum num 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "a311b77ebdc5dd4cf6449d81e4135d9f0e3b153839ac90e648a8ef538f923525"
 "checksum num-derive 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0d2c31b75c36a993d30c7a13d70513cb93f02acafdd5b7ba250f9b0e18615de7"
-"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea"
+"checksum num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "d1452e8b06e448a07f0e6ebb0bb1d92b8890eea63288c0b627331d53514d0fba"
+"checksum num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)" = "7485fcc84f85b4ecd0ea527b14189281cf27d60e583ae65ebc9c088b13dffe01"
 "checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31"
-"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1"
+"checksum num-traits 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e7de20f146db9d920c45ee8ed8f71681fd9ade71909b48c3acbd766aa504cf10"
 "checksum num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "514f0d73e64be53ff320680ca671b64fe3fb91da01e1ae2ddc99eb51d453b20d"
 "checksum ordered-float 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2f0015e9e8e28ee20c581cfbfe47c650cedeb9ed0721090e0b7ebb10b9cdbcc2"
 "checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063"
 "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
 "checksum parking_lot 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "69376b761943787ebd5cc85a5bc95958651a22609c5c1c2b65de21786baec72b"
 "checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa"
 "checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
 "checksum percent-encoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de154f638187706bde41d9b4738748933d64e6b37bdbffc0b47a97d16a6ae356"
@@ -3075,9 +3095,9 @@ dependencies = [
 "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
 "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
 "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
 "checksum wincolor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eeb06499a3a4d44302791052df005d5232b927ed1a9658146d842165c4de7767"
 "checksum winreg 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a27a759395c1195c4cc5cda607ef6f8f6498f64e78f7900f5de0a127a424704a"
 "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
 "checksum xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c1cb601d29fe2c2ac60a2b2e5e293994d87a1f6fa9687a31a15270f909be9c2"
 "checksum yaml-rust 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "57ab38ee1a4a266ed033496cf9af1828d8d6e6c1cfa5f643a2809effcae4d628"
-"checksum zip 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "36b9e08fb518a65cf7e08a1e482573eb87a2f4f8c6619316612a3c1f162fe822"
+"checksum zip 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "77ce0ceee93c995954a31f77903925a6a8bb094709445238e344f2107910e29e"
--- a/testing/geckodriver/Cargo.toml
+++ b/testing/geckodriver/Cargo.toml
@@ -5,26 +5,26 @@ description = "Proxy for using WebDriver
 keywords = ["webdriver", "w3c", "httpd", "mozilla", "firefox"]
 repository = "https://hg.mozilla.org/mozilla-central/file/tip/testing/geckodriver"
 readme = "README.md"
 license = "MPL-2.0"
 publish = false
 
 [dependencies]
 base64 = "0.9"
-chrono = "0.4.6"
+chrono = "^0.2"
 clap = { version = "^2.19", default-features = false, features = ["suggestions", "wrap_help"] }
 hyper = "0.12"
 lazy_static = "1.0"
 log = { version = "0.4", features = ["std"] }
 mozprofile = { path = "../mozbase/rust/mozprofile" }
 mozrunner = { path = "../mozbase/rust/mozrunner" }
 mozversion = { path = "../mozbase/rust/mozversion" }
 regex = "1.0"
 serde = "1.0"
 serde_json = "1.0"
 serde_derive = "1.0"
 uuid = { version = "0.5", features = ["v4"] }
 webdriver = { path = "../webdriver" }
-zip = "0.4"
+zip = "0.3"
 
 [[bin]]
 name = "geckodriver"
--- a/third_party/rust/chrono/.cargo-checksum.json
+++ b/third_party/rust/chrono/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".travis.yml":"40caf89b122270034144d7875fcb27cf7ca9b0e150949e1a908932c4e491956f","AUTHORS.txt":"80aa54d9642f63fc62f20f60e0550f3e596de6ea69883769313c7f07a4be8f4c","CHANGELOG.md":"b9d2b2edfb98954c22e3a34c044bbd2f542cae703d06e5cf15245a1e26b32f76","Cargo.toml":"95d58b3f9a862b6bfd497e8aa87cc14ba6a43e7f6d1818094073e611db14ce43","LICENSE.txt":"46610329ff0b38effb9cb05979ff1ef761e465fed96b2eaca39e439d00129fd7","Makefile":"d76b0b1a44e90b31f2a6f97f662d65df585b1dc88253c30c01ea38d9a097a83e","README.md":"8df7579a4ce5ed034b85b91f6f3106573443138dcc568fd76063016ad2d5cc38","appveyor.yml":"b10751e92a0299968ac5cfd65e918d99e680b6ac679362655b92a393cd22c212","ci/fix-readme.sh":"750d262640a6fdc846623a569f37954bfe7604f9bcbc8f7475db38192e1da0fb","ci/travis.sh":"48eb316d163a9c5b37e4b1d4773e2f9934359a3a1dbddc3b6ae6a58ef15856b1","src/date.rs":"c8d61716eaecf8d0e1a887a0ac9bc06d2e5bf0b47eccc61e5683bdeb0f886ff8","src/datetime.rs":"34e71d822cfa70bb6d1041e3d865fcf629ffb2e29021713bd6aee8a3a6d1410f","src/div.rs":"02e6ce9c4fcafcc7931574108dd7ec0cd28b137edb52eaea654a09ab05fbaf90","src/format/mod.rs":"e36b2bee352df7f0addec7365edfd73607ebaa903d3ddb9249f5fe3c11d9da7a","src/format/parse.rs":"8d5b39483c48771932fd75a9d9892967bd7ef6f0c88d55be6a2d35d35ba21f52","src/format/parsed.rs":"a65cbc0ba13190028ca7c4de4a830b8a64acaf375285cae3a1da1bfd6e5d32f8","src/format/scan.rs":"9f8e4ce8001caf9ec76b3eddf7aa9cc5a68606165e3bb53977350c0a03536b79","src/format/strftime.rs":"532f88654cc1531e6ebdea89039bcf2c364e97478c83824f97f1c38277f3c827","src/lib.rs":"1dae4eb3a73db8dc8fd4f5d3e431fc773104a35c9efaa7a301d73f7b898fc464","src/naive/date.rs":"2fbd7069fb576416f2111298cdd59c729e70736abe53d6e69313a4e45f8a6e3d","src/naive/datetime.rs":"5ae4ed07dc199f7f4be27ef18130de385b56dceb01cefafe5e0f0eb9ed39ce7b","src/naive/internals.rs":"db79eda586b7daad5a2645d21bda80ae92f9bee9870d93d2209a7d228e4286c7","src/naive/isoweek.rs":"75101e996e0eccc6f9b2147095d82050e6dac94a741db60f654f4267bbe96fed","src/naive/time.rs":"cfa4936b341246eb0692e0a071d93707f3545825c74aee67749442ecd2aba655","src/offset/fixed.rs":"e0e41c7081e908a8ada1c1bb67fd003f8a36510c542c5088756214e276407cb9","src/offset/local.rs":"c63a88b8ab4af289cef15d04189f9656c8dfcff77fe8417bbd1182b75184f4e6","src/offset/mod.rs":"2aeeb0fa4c657e810f78ff239d7c52f07c33a2b7bdfc8b3765f4339dcafa0088","src/offset/utc.rs":"630f9513f88353892c9f554eed35d5ec204da9b3d65e7b3c44998836ba3d2d9b","src/oldtime.rs":"42f09a5679c8326ba8f0fe068b35ed1066801903c44b2abfd93f00ef5ec62dbc","src/round.rs":"f7ef334fe4d3014b8a6421202b4a50d316d74199ac154ff553548e8c2c58aa80"},"package":"45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878"}
\ No newline at end of file
+{"files":{".travis.yml":"e4721fe8d991d6b9f58da6fba573906a759b58b49ba58cb15b0ca279b3bc53cb","AUTHORS.txt":"4ba13d189cb419382ef9837e74de67c2dba98ff1b378816de2a3f59922da598a","CHANGELOG.md":"5dcce1ee25d1e37a0fa3ce162568061787a13870297d5f95bffa44156efe8701","Cargo.toml":"d7703847fb88c9edcd69a7ce84a4098d21a6dfa2159454067cf9bd56577073ac","LICENSE.txt":"37064a3e3254d5a0c7963d476125e25762e86adadc71959549767486e37c8038","Makefile":"6901ba54f43a90422482457a9237edbee41490b394c09fe5a7d40129db7be5b0","README.md":"d674954a5135c85e2af5e6efa3480b64f16f79dcfface35b01dd837c3b942af6","src/date.rs":"54ccfd7964c1d0ef601c8818bd59c88bf2fb61b51ea78336f190f5e793a47b8d","src/datetime.rs":"400cf1666cfc7224b2e38fbab31236a07f9d75418c9c7b3962d9871e4bda51af","src/div.rs":"bf03964177e2960b0c4726f4856f12b597a59b051241e2a0121501b78825dce8","src/format/mod.rs":"ff50334f39ce537e4745424c8e1a7632a8ec5179fd9047fa0d6cf622d6ce182a","src/format/parse.rs":"0b3ac142ac27b7a32618684b18453e2fd43c7d7d7ddc9b3adbf395c5934e0f1c","src/format/parsed.rs":"6ce9196fa34f29e64a1bc14e76a35b76f4ad5bf72711df8eba2b196aad5ec811","src/format/scan.rs":"ea5ebe5ab966c70f18605edce9a55098ee5f661da1a02b0710559d76067bab79","src/format/strftime.rs":"35ee925171f8c02e876a9b4f515d6ba7eadf3fc8cc914759bee382d5821270e7","src/lib.rs":"1e88f2bdc97130bd6ec3f87bfec4d671167cd66e9daa953b7ce11ceb5ea62928","src/naive/date.rs":"ad4e6b0a4ad939afd79981015d4b2004a33f66abd3c0a3d18a0765d6b87900a1","src/naive/datetime.rs":"317ab30a8648aef7440da5a813a55a7346c24ff13953436bcae7f6888ed0a0c6","src/naive/time.rs":"dab2c7a6cbd8943a1a775c6c8a9a042fed0dacca623c741871d3969a592d733f","src/offset/fixed.rs":"9f103b5abb3927a19bfeb533db5a695451a5e474ed645c7cf1ac52649bc5fe8a","src/offset/local.rs":"c29fdd66a0dd39f32ded7834479dd8755022a791fb13be1ae5027999a86e4a9e","src/offset/mod.rs":"3e732d056a29585d3eecd74ccdbb38c050d08def9d10f0000a7328761e6c77e6","src/offset/utc.rs":"072b460f6b726877344207e68edc00507e08d8a9168f9f571b6631a0c73ea7be"},"package":"9213f7cd7c27e95c2b57c49f0e69b1ea65b27138da84a170133fd21b07659c00"}
\ No newline at end of file
--- a/third_party/rust/chrono/.travis.yml
+++ b/third_party/rust/chrono/.travis.yml
@@ -1,32 +1,18 @@
 language: rust
-sudo: false
-rust:
-  # 1.13.0 is the earliest version that Serde 1.0 tests, so we follow suit
-  - 1.13.0
-  - stable
-  - beta
-  - nightly
 os:
   - linux
   - osx
-matrix:
-  allow_failures:
-    - rust: nightly
-      env: CLIPPY=n
-  include:
-    - rust: nightly
-      env: CLIPPY=y
-
 env:
   global:
     - LD_LIBRARY_PATH: /usr/local/lib
-    - CLIPPY: n
-script: ./ci/travis.sh
-notifications:
-  email: false
-  irc:
-    channels:
-      - "irc.mozilla.org#chronotope"
-    template:
-      - "%{repository_slug}/%{branch} (%{commit} - %{author}): %{message}"
-    skip_join: true
+    - secure: i8Ijk6g4/26e3e7+r2OeGAPSP8G8O9P50JibW1omJ0j0ixXhyhPoY2bch3CGhnOu44dI5O31IIbjJJ+iEMp29xQBvkv9YpxAI+hIzOP+XAH6GCYxUDiBVcDoWrXTj+wU6/veuvjLCunu4eRHlskrgJbZXhUVODYzJuLgsN8Ou0w=
+script:
+  - cargo build -v
+  - cargo build -v --features rustc-serialize
+  - cargo build -v --features serde
+  - cargo test -v
+  - cargo test -v --features rustc-serialize
+  - cargo test -v --features serde
+  - cargo doc
+after_script:
+  - cd target && curl http://www.rust-ci.org/artifacts/put?t=$RUSTCI_TOKEN | sh
--- a/third_party/rust/chrono/AUTHORS.txt
+++ b/third_party/rust/chrono/AUTHORS.txt
@@ -1,39 +1,26 @@
 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 Boeckel <mathstuf@gmail.com>
 Ben Eills <ben@beneills.com>
-Brandon W Maister <bwm@knewton.com>
-Brandon W Maister <quodlibetor@gmail.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>
-Eric Findlay <e.findlay@protonmail.ch>
 Eunchong Yu <kroisse@gmail.com>
-Frans Skarman <frans.skarman@gmail.com>
 Huon Wilson <dbau.pp+github@gmail.com>
-Igor Gnatenko <ignatenko@redhat.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>
-Jonas mg <jonasmg@yepmail.net>
-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>
 Tom Gallacher <tomgallacher23@gmail.com>
 klutzy <klutzytheklutzy@gmail.com>
 kud1ing <github@kudling.de>
--- a/third_party/rust/chrono/CHANGELOG.md
+++ b/third_party/rust/chrono/CHANGELOG.md
@@ -1,269 +1,20 @@
 ChangeLog for Chrono
 ====================
 
-This documents all notable changes to [Chrono](https://github.com/chronotope/chrono).
+This documents all notable changes to [Chrono](https://github.com/lifthrasiir/rust-chrono).
 
 Chrono obeys the principle of [Semantic Versioning](http://semver.org/).
 
 There were/are numerous minor versions before 1.0 due to the language changes.
 Versions with only mechnical changes will be omitted from the following list.
 
-## 0.4.5
-
-### Features
-
-* Added several more serde deserialization helpers (@novacrazy #258)
-* Enabled all features on the playground (@davidtwco #267)
-* Derive `Hash` on `FixedOffset` (@LuoZijun #254)
-* Improved docs (@storyfeet #261, @quodlibetor #252)
-
-## 0.4.4
-
-### Features
-
-* Added support for parsing nanoseconds without the leading dot (@emschwartz #251)
-
-## 0.4.3
-
-### Features
-
-* Added methods to DateTime/NaiveDateTime to present the stored value as a number
-  of nanoseconds since the UNIX epoch (@harkonenbade #247)
-* Added a serde serialise/deserialise module for nanosecond timestamps. (@harkonenbade #247)
-* Added "Permissive" timezone parsing which allows a numeric timezone to
-  be specified without minutes. (@quodlibetor #242)
-
-## 0.4.2
-
-### Deprecations
-
-* More strongly deprecate RustcSerialize: remove it from documentation unless
-  the feature is enabled, issue a deprecation warning if the rustc-serialize
-  feature is enabled (@quodlibetor #174)
-
-### Features
-
-* Move all uses of the system clock behind a `clock` feature, for use in
-  environments where we don't have access to the current time. (@jethrogb #236)
-* Implement subtraction of two `Date`s, `Time`s, or `DateTime`s, returning a
-  `Duration` (@tobz1000 #237)
-
-## 0.4.1
-
-### Bug Fixes
-
-* Allow parsing timestamps with subsecond precision (@jonasbb)
-* RFC2822 allows times to not include the second (@upsuper)
-
-### Features
-
-* New `timestamp_millis` method on `DateTime` and `NaiveDateTim` that returns
-  number of milliseconds since the epoch. (@quodlibetor)
-* Support exact decimal width on subsecond display for RFC3339 via a new
-  `to_rfc3339_opts` method on `DateTime` (@dekellum)
-* Use no_std-compatible num dependencies (@cuviper)
-* Add `SubsecRound` trait that allows rounding to the nearest second
-  (@dekellum)
-
-### Code Hygiene and Docs
-
-* Docs! (@alatiera @kosta @quodlibetor @kennytm)
-* Run clippy and various fixes (@quodlibetor)
-
-## 0.4.0 (2017-06-22)
-
-This was originally planned as a minor release but was pushed to a major
-release due to the compatibility concern raised.
-
-### Added
-
-- `IsoWeek` has been added for the ISO week without time zone.
-
-- The `+=` and `-=` operators against `time::Duration` are now supported for
-  `NaiveDate`, `NaiveTime` and `NaiveDateTime`. (#99)
-
-  (Note that this does not invalidate the eventual deprecation of `time::Duration`.)
-
-- `SystemTime` and `DateTime<Tz>` types can be now converted to each other via `From`.
-  Due to the obvious lack of time zone information in `SystemTime`,
-  the forward direction is limited to `DateTime<Utc>` and `DateTime<Local>` only.
-
-### Changed
-
-- Intermediate implementation modules have been flattened (#161),
-  and `UTC` has been renamed to `Utc` in accordance with the current convention (#148).
-
-  The full list of changes is as follows:
-
-  Before                                   | After
-  ---------------------------------------- | ----------------------------
-  `chrono::date::Date`                     | `chrono::Date`
-  `chrono::date::MIN`                      | `chrono::MIN_DATE`
-  `chrono::date::MAX`                      | `chrono::MAX_DATE`
-  `chrono::datetime::DateTime`             | `chrono::DateTime`
-  `chrono::naive::time::NaiveTime`         | `chrono::naive::NaiveTime`
-  `chrono::naive::date::NaiveDate`         | `chrono::naive::NaiveDate`
-  `chrono::naive::date::MIN`               | `chrono::naive::MIN_DATE`
-  `chrono::naive::date::MAX`               | `chrono::naive::MAX_DATE`
-  `chrono::naive::datetime::NaiveDateTime` | `chrono::naive::NaiveDateTime`
-  `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`
-
-  With an exception of `Utc`, this change does not affect any direct usage of
-  `chrono::*` or `chrono::prelude::*` types.
-
-- `Datelike::isoweekdate` is replaced by `Datelike::iso_week` which only returns the ISO week.
-
-  The original method used to return a tuple of year number, week number and day of the week,
-  but this duplicated the `Datelike::weekday` method and it had been hard to deal with
-  the raw year and week number for the ISO week date.
-  This change isolates any logic and API for the week date into a separate type.
-
-- `NaiveDateTime` and `DateTime` can now be deserialized from an integral UNIX timestamp. (#125)
-
-  This turns out to be very common input for web-related usages.
-  The existing string representation is still supported as well.
-
-- `chrono::serde` and `chrono::naive::serde` modules have been added
-  for the serialization utilities. (#125)
-
-  Currently they contain the `ts_seconds` modules that can be used to
-  serialize `NaiveDateTime` and `DateTime` values into an integral UNIX timestamp.
-  This can be combined with Serde's `[de]serialize_with` attributes
-  to fully support the (de)serialization to/from the timestamp.
-
-  For rustc-serialize, there are separate `chrono::TsSeconds` and `chrono::naive::TsSeconds` types
-  that are newtype wrappers implementing different (de)serialization logics.
-  This is a suboptimal API, however, and it is strongly recommended to migrate to Serde.
-
-### Fixed
-
-- The major version was made to fix the broken Serde dependency issues. (#146, #156, #158, #159)
-
-  The original intention to technically break the dependency was
-  to faciliate the use of Serde 1.0 at the expense of temporary breakage.
-  Whether this was appropriate or not is quite debatable,
-  but it became clear that there are several high-profile crates requiring Serde 0.9
-  and it is not feasible to force them to use Serde 1.0 anyway.
-
-  To the end, the new major release was made with some known lower-priority breaking changes.
-  0.3.1 is now yanked and any remaining 0.3 users can safely roll back to 0.3.0.
-
-- Various documentation fixes and goodies. (#92, #131, #136)
-
-## 0.3.1 (2017-05-02)
-
-### Added
-
-- `Weekday` now implements `FromStr`, `Serialize` and `Deserialize`. (#113)
-
-  The syntax is identical to `%A`, i.e. either the shortest or the longest form of English names.
-
-### Changed
-
-- Serde 1.0 is now supported. (#142)
-
-  This is technically a breaking change because Serde 0.9 and 1.0 are not compatible,
-  but this time we decided not to issue a minor version because
-  we have already seen Serde 0.8 and 0.9 compatibility problems even after 0.3.0 and
-  a new minor version turned out to be not very helpful for this kind of issues.
-
-### Fixed
-
-- Fixed a bug that the leap second can be mapped wrongly in the local time zone.
-  Only occurs when the local time zone is behind UTC. (#130)
-
-## 0.3.0 (2017-02-07)
-
-The project has moved to the [Chronotope](https://github.com/chronotope/) organization.
-
-### Added
-
-- `chrono::prelude` module has been added. All other glob imports are now discouraged.
-
-- `FixedOffset` can be added to or subtracted from any timelike types.
-
-    - `FixedOffset::local_minus_utc` and `FixedOffset::utc_minus_local` methods have been added.
-      Note that the old `Offset::local_minus_utc` method is gone; see below.
-
-- Serde support for non-self-describing formats like Bincode is added. (#89)
-
-- Added `Item::Owned{Literal,Space}` variants for owned formatting items. (#76)
-
-- Formatting items and the `Parsed` type have been slightly adjusted so that
-  they can be internally extended without breaking any compatibility.
-
-- `Weekday` is now `Hash`able. (#109)
-
-- `ParseError` now implements `Eq` as well as `PartialEq`. (#114)
-
-- More documentation improvements. (#101, #108, #112)
-
-### Changed
-
-- Chrono now only supports Rust 1.13.0 or later (previously: Rust 1.8.0 or later).
-
-- Serde 0.9 is now supported.
-  Due to the API difference, support for 0.8 or older is discontinued. (#122)
-
-- Rustc-serialize implementations are now on par with corresponding Serde implementations.
-  They both standardize on the `std::fmt::Debug` textual output.
-
-  **This is a silent breaking change (hopefully the last though).**
-  You should be prepared for the format change if you depended on rustc-serialize.
-
-- `Offset::local_minus_utc` is now `Offset::fix`, and returns `FixedOffset` instead of a duration.
-
-  This makes every time zone operation operate within a bias less than one day,
-  and vastly simplifies many logics.
-
-- `chrono::format::format` now receives `FixedOffset` instead of `time::Duration`.
-
-- The following methods and implementations have been renamed and older names have been *removed*.
-  The older names will be reused for the same methods with `std::time::Duration` in the future.
-
-    - `checked_*` → `checked_*_signed` in `Date`, `DateTime`, `NaiveDate` and `NaiveDateTime` types
-
-    - `overflowing_*` → `overflowing_*_signed` in the `NaiveTime` type
-
-    - All subtraction implementations between two time instants have been moved to
-      `signed_duration_since`, following the naming in `std::time`.
-
-### Fixed
-
-- Fixed a panic when the `Local` offset receives a leap second. (#123)
-
-### Removed
-
-- Rustc-serialize support for `Date<Tz>` types and all offset types has been dropped.
-
-  These implementations were automatically derived and never had been in a good shape.
-  Moreover there are no corresponding Serde implementations, limiting their usefulness.
-  In the future they may be revived with more complete implementations.
-
-- The following method aliases deprecated in the 0.2 branch have been removed.
-
-    - `DateTime::num_seconds_from_unix_epoch` (→ `DateTime::timestamp`)
-    - `NaiveDateTime::from_num_seconds_from_unix_epoch` (→ `NaiveDateTime::from_timestamp`)
-    - `NaiveDateTime::from_num_seconds_from_unix_epoch_opt` (→ `NaiveDateTime::from_timestamp_opt`)
-    - `NaiveDateTime::num_seconds_unix_epoch` (→ `NaiveDateTime::timestamp`)
-
-- Formatting items are no longer `Copy`, except for `chrono::format::Pad`.
-
-- `chrono::offset::add_with_leapsecond` has been removed.
-  Use a direct addition with `FixedOffset` instead.
-
 ## 0.2.25 (2016-08-04)
 
-This is the last version officially supports Rust 1.12.0 or older.
-
 (0.2.24 was accidentally uploaded without a proper check for warnings in the default state,
 and replaced by 0.2.25 very shortly. Duh.)
 
 ### Added
 
 - Serde 0.8 is now supported. 0.7 also remains supported. (#86)
 
 ### Fixed
--- a/third_party/rust/chrono/Cargo.toml
+++ b/third_party/rust/chrono/Cargo.toml
@@ -1,72 +1,24 @@
-# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
-#
-# When uploading crates to the registry Cargo will automatically
-# "normalize" Cargo.toml files for maximal compatibility
-# with all versions of Cargo and also rewrite `path` dependencies
-# to registry (e.g. crates.io) dependencies
-#
-# If you believe there's an error in this file please file an
-# issue against the rust-lang/cargo repository. If you're
-# editing this file be aware that the upstream Cargo.toml
-# will likely look very different (and much more reasonable)
-
 [package]
 name = "chrono"
-version = "0.4.6"
-authors = ["Kang Seonghoon <public+rust@mearie.org>", "Brandon W Maister <quodlibetor@gmail.com>"]
+version = "0.2.25"
+authors = ["Kang Seonghoon <public+rust@mearie.org>"]
+
 description = "Date and time library for Rust"
-homepage = "https://github.com/chronotope/chrono"
-documentation = "https://docs.rs/chrono/"
-readme = "README.md"
+homepage = "https://github.com/lifthrasiir/rust-chrono"
+documentation = "https://lifthrasiir.github.io/rust-chrono/"
+repository = "https://github.com/lifthrasiir/rust-chrono"
 keywords = ["date", "time", "calendar"]
-categories = ["date-and-time"]
+readme = "README.md"
 license = "MIT/Apache-2.0"
-repository = "https://github.com/chronotope/chrono"
-[package.metadata.docs.rs]
-all-features = true
-
-[package.metadata.playground]
-all-features = true
 
 [lib]
 name = "chrono"
-[dependencies.num-integer]
-version = "0.1.36"
-default-features = false
-
-[dependencies.num-traits]
-version = "0.2"
-default-features = false
-
-[dependencies.rustc-serialize]
-version = "0.3.20"
-optional = true
-
-[dependencies.serde]
-version = "1"
-optional = true
 
-[dependencies.time]
-version = "0.1.39"
-optional = true
-[dev-dependencies.bincode]
-version = "0.8.0"
-
-[dev-dependencies.num-iter]
-version = "0.1.35"
-default-features = false
+[dependencies]
+time = "0.1"
+num = { version = "0.1", default-features = false }
+rustc-serialize = { version = "0.3", optional = true }
+serde = { version = "<0.9", optional = true }
 
-[dev-dependencies.serde_derive]
-version = "1"
-
-[dev-dependencies.serde_json]
-version = "1"
-
-[features]
-clock = ["time"]
-default = ["clock"]
-[badges.appveyor]
-repository = "chronotope/chrono"
-
-[badges.travis-ci]
-repository = "chronotope/chrono"
+[dev-dependencies]
+serde_json = { version = ">=0.7.0" }
--- a/third_party/rust/chrono/LICENSE.txt
+++ b/third_party/rust/chrono/LICENSE.txt
@@ -1,11 +1,10 @@
 Rust-chrono is dual-licensed under The MIT License [1] and
-Apache 2.0 License [2]. Copyright (c) 2014--2017, Kang Seonghoon and
-contributors.
+Apache 2.0 License [2]. Copyright (c) 2014, Kang Seonghoon.
 
 Nota Bene: This is same as the Rust Project's own license.
 
 
 [1]: <http://opensource.org/licenses/MIT>, which is reproduced below:
 
 ~~~~
 The MIT License (MIT)
--- a/third_party/rust/chrono/Makefile
+++ b/third_party/rust/chrono/Makefile
@@ -7,24 +7,54 @@ all:
 
 .PHONY: authors
 authors:
 	echo 'Chrono is mainly written by Kang Seonghoon <public+rust@mearie.org>,' > AUTHORS.txt
 	echo 'and also the following people (in ascending order):' >> AUTHORS.txt
 	echo >> AUTHORS.txt
 	git log --format='%aN <%aE>' | grep -v 'Kang Seonghoon' | sort -u >> AUTHORS.txt
 
-.PHONY: readme README.md
+.PHONY: readme
 readme: README.md
 
 README.md: src/lib.rs
-	( ./ci/fix-readme.sh $< ) > $@
+	# really, really sorry for this mess.
+	awk '/^\/\/! # Chrono /{print "[Chrono][doc]",$$4}' $< > $@
+	awk '/^\/\/! # Chrono /{print "[Chrono][doc]",$$4}' $< | sed 's/./=/g' >> $@
+	echo >> $@
+	echo '[![Chrono on Travis CI][travis-image]][travis]' >> $@
+	echo >> $@
+	echo '[travis-image]: https://travis-ci.org/lifthrasiir/rust-chrono.png' >> $@
+	echo '[travis]: https://travis-ci.org/lifthrasiir/rust-chrono' >> $@
+	awk '/^\/\/! # Chrono /,/^\/\/! ## /' $< | cut -b 5- | grep -v '^#' | \
+		sed 's/](\.\//](https:\/\/lifthrasiir.github.io\/rust-chrono\/chrono\//g' >> $@
+	echo '[Complete Documentation][doc]' >> $@
+	echo >> $@
+	echo '[doc]: https://lifthrasiir.github.io/rust-chrono/' >> $@
+	echo >> $@
+	awk '/^\/\/! ## /,!/^\/\/!/' $< | cut -b 5- | grep -v '^# ' | \
+		sed 's/](\.\//](https:\/\/lifthrasiir.github.io\/rust-chrono\/chrono\//g' >> $@
 
 .PHONY: test
 test:
-	TZ=UTC0 cargo test --features 'serde rustc-serialize bincode' --lib
-	TZ=ACST-9:30 cargo test --features 'serde rustc-serialize bincode' --lib
-	TZ=EST4 cargo test --features 'serde rustc-serialize bincode'
+	cargo test --features 'serde rustc-serialize'
 
 .PHONY: doc
 doc: authors readme
-	cargo doc --features 'serde rustc-serialize bincode'
+	cargo doc --features 'serde rustc-serialize'
 
+.PHONY: doc-publish
+doc-publish: doc
+	( \
+		PKGID="$$(cargo pkgid)"; \
+		PKGNAMEVER="$${PKGID#*#}"; \
+		PKGNAME="$${PKGNAMEVER%:*}"; \
+		REMOTE="$$(git config --get remote.origin.url)"; \
+		cd target/doc && \
+		rm -rf .git && \
+		git init && \
+		git checkout --orphan gh-pages && \
+		echo '<!doctype html><html><head><meta http-equiv="refresh" content="0;URL='$$PKGNAME'/index.html"></head><body></body></html>' > index.html && \
+		git add . && \
+		git commit -m 'updated docs.' && \
+		git push "$$REMOTE" gh-pages -f; \
+	)
+
--- a/third_party/rust/chrono/README.md
+++ b/third_party/rust/chrono/README.md
@@ -1,391 +1,322 @@
-[Chrono][docsrs]: Date and Time for Rust
-========================================
+[Chrono][doc] 0.2.25
+====================
 
 [![Chrono on Travis CI][travis-image]][travis]
-[![Chrono on Appveyor][appveyor-image]][appveyor]
-[![Chrono on crates.io][cratesio-image]][cratesio]
-[![Chrono on docs.rs][docsrs-image]][docsrs]
-[![Join the chat at https://gitter.im/chrono-rs/chrono][gitter-image]][gitter]
 
-[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
-[docsrs-image]: https://docs.rs/chrono/badge.svg
-[docsrs]: https://docs.rs/chrono
-[gitter-image]: https://badges.gitter.im/chrono-rs/chrono.svg
-[gitter]: https://gitter.im/chrono-rs/chrono
+[travis-image]: https://travis-ci.org/lifthrasiir/rust-chrono.png
+[travis]: https://travis-ci.org/lifthrasiir/rust-chrono
 
+Date and time handling for Rust. (also known as `rust-chrono`)
 It aims to be a feature-complete superset of
 the [time](https://github.com/rust-lang-deprecated/time) library.
 In particular,
 
 * Chrono strictly adheres to ISO 8601.
 * Chrono is timezone-aware by default, with separate timezone-naive types.
 * Chrono is space-optimal and (while not being the primary goal) reasonably efficient.
 
 There were several previous attempts to bring a good date and time library to Rust,
-which Chrono builds upon and should acknowledge:
+which Chrono builts upon and should acknowledge:
 
 * [Initial research on
    the wiki](https://github.com/rust-lang/rust-wiki-backup/blob/master/Lib-datetime.md)
 * Dietrich Epp's [datetime-rs](https://github.com/depp/datetime-rs)
 * Luis de Bethencourt's [rust-datetime](https://github.com/luisbg/rust-datetime)
 
-Any significant changes to Chrono are documented in
-the [`CHANGELOG.md`](https://github.com/chronotope/chrono/blob/master/CHANGELOG.md) file.
+[Complete Documentation][doc]
 
+[doc]: https://lifthrasiir.github.io/rust-chrono/
 
 ## Usage
 
 Put this in your `Cargo.toml`:
 
 ```toml
 [dependencies]
-chrono = "0.4"
+chrono = "0.2"
 ```
 
-Or, if you want [Serde](https://github.com/serde-rs/serde) include the
-feature like this:
+Or, if you want [Serde](https://github.com/serde-rs/serde) or
+[rustc-serialize](https://github.com/rust-lang-nursery/rustc-serialize) support,
+include the features like this:
 
 ```toml
 [dependencies]
-chrono = { version = "0.4", features = ["serde"] }
+chrono = { version = "0.2", features = ["serde", "rustc-serialize"] }
 ```
 
 Then put this in your crate root:
 
 ```rust
 extern crate chrono;
 ```
 
-Avoid using `use chrono::*;` as Chrono exports several modules other than types.
-If you prefer the glob imports, use the following instead:
-
-```rust
-use chrono::prelude::*;
-```
-
 ## Overview
 
 ### Duration
 
-Chrono currently uses
-the [`time::Duration`](https://docs.rs/time/0.1.40/time/struct.Duration.html) type
-from the `time` crate to represent the magnitude of a time span.
-Since this has the same name to the newer, standard type for duration,
-the reference will refer this type as `OldDuration`.
-Note that this is an "accurate" duration represented as seconds and
-nanoseconds and does not represent "nominal" components such as days or
-months.
-
-Chrono does not yet natively support
-the standard [`Duration`](https://docs.rs/time/0.1.40/time/struct.Duration.html) type,
-but it will be supported in the future.
-Meanwhile you can convert between two types with
-[`Duration::from_std`](https://docs.rs/time/0.1.40/time/struct.Duration.html#method.from_std)
-and
-[`Duration::to_std`](https://docs.rs/time/0.1.40/time/struct.Duration.html#method.to_std)
-methods.
+[**`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.
 
 ### Date and Time
 
 Chrono provides a
-[**`DateTime`**](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html)
+[**`DateTime`**](https://lifthrasiir.github.io/rust-chrono/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
 that is unconcerned with timezones, consider
 [`time::SystemTime`](https://doc.rust-lang.org/std/time/struct.SystemTime.html),
 which tracks your system clock, or
 [`time::Instant`](https://doc.rust-lang.org/std/time/struct.Instant.html), which
 is an opaque but monotonically-increasing representation of a moment in time.
 
 `DateTime` is timezone-aware and must be constructed from
-the [**`TimeZone`**](https://docs.rs/chrono/0.4.6/chrono/offset/trait.TimeZone.html) object,
+the [**`TimeZone`**](https://lifthrasiir.github.io/rust-chrono/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://docs.rs/chrono/0.4.6/chrono/offset/struct.Utc.html) specifies the UTC time zone. It is most efficient.
+* [**`UTC`**](https://lifthrasiir.github.io/rust-chrono/chrono/offset/utc/struct.UTC.html) specifies the UTC time zone. It is most efficient.
 
-* [**`Local`**](https://docs.rs/chrono/0.4.6/chrono/offset/struct.Local.html) specifies the system local time zone.
+* [**`Local`**](https://lifthrasiir.github.io/rust-chrono/chrono/offset/local/struct.Local.html) specifies the system local time zone.
 
-* [**`FixedOffset`**](https://docs.rs/chrono/0.4.6/chrono/offset/struct.FixedOffset.html) specifies
+* [**`FixedOffset`**](https://lifthrasiir.github.io/rust-chrono/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,
   you would want to normalize other `TimeZone`s into this type.
 
 `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://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.with_timezone) method.
+the [`DateTime::with_timezone`](https://lifthrasiir.github.io/rust-chrono/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://docs.rs/chrono/0.4.6/chrono/offset/struct.Utc.html#method.now))
+([`UTC::now()`](https://lifthrasiir.github.io/rust-chrono/chrono/offset/utc/struct.UTC.html#method.now))
 or in the local time zone
-([`Local::now()`](https://docs.rs/chrono/0.4.6/chrono/offset/struct.Local.html#method.now)).
+([`Local::now()`](https://lifthrasiir.github.io/rust-chrono/chrono/offset/local/struct.Local.html#method.now)).
 
-```rust
-use chrono::prelude::*;
+~~~~ {.rust}
+use chrono::*;
 
-let utc: DateTime<Utc> = Utc::now();       // e.g. `2014-11-28T12:45:59.324310806Z`
+let utc: DateTime<UTC> = UTC::now();       // e.g. `2014-11-28T12:45:59.324310806Z`
 let local: DateTime<Local> = Local::now(); // e.g. `2014-11-28T21:45:59.324310806+09:00`
-```
+~~~~
 
 Alternatively, you can create your own date and time.
 This is a bit verbose due to Rust's lack of function and method overloading,
 but in turn we get a rich combination of initialization methods.
 
-```rust
-use chrono::prelude::*;
-use chrono::offset::LocalResult;
+~~~~ {.rust}
+use chrono::*;
 
-let dt = Utc.ymd(2014, 7, 8).and_hms(9, 10, 11); // `2014-07-08T09:10:11Z`
+let dt = UTC.ymd(2014, 7, 8).and_hms(9, 10, 11); // `2014-07-08T09:10:11Z`
 // July 8 is 188th day of the year 2014 (`o` for "ordinal")
-assert_eq!(dt, Utc.yo(2014, 189).and_hms(9, 10, 11));
+assert_eq!(dt, UTC.yo(2014, 189).and_hms(9, 10, 11));
 // July 8 is Tuesday in ISO week 28 of the year 2014.
-assert_eq!(dt, Utc.isoywd(2014, 28, Weekday::Tue).and_hms(9, 10, 11));
+assert_eq!(dt, UTC.isoywd(2014, 28, Weekday::Tue).and_hms(9, 10, 11));
 
-let dt = Utc.ymd(2014, 7, 8).and_hms_milli(9, 10, 11, 12); // `2014-07-08T09:10:11.012Z`
-assert_eq!(dt, Utc.ymd(2014, 7, 8).and_hms_micro(9, 10, 11, 12_000));
-assert_eq!(dt, Utc.ymd(2014, 7, 8).and_hms_nano(9, 10, 11, 12_000_000));
+let dt = UTC.ymd(2014, 7, 8).and_hms_milli(9, 10, 11, 12); // `2014-07-08T09:10:11.012Z`
+assert_eq!(dt, UTC.ymd(2014, 7, 8).and_hms_micro(9, 10, 11, 12_000));
+assert_eq!(dt, UTC.ymd(2014, 7, 8).and_hms_nano(9, 10, 11, 12_000_000));
 
 // dynamic verification
-assert_eq!(Utc.ymd_opt(2014, 7, 8).and_hms_opt(21, 15, 33),
-           LocalResult::Single(Utc.ymd(2014, 7, 8).and_hms(21, 15, 33)));
-assert_eq!(Utc.ymd_opt(2014, 7, 8).and_hms_opt(80, 15, 33), LocalResult::None);
-assert_eq!(Utc.ymd_opt(2014, 7, 38).and_hms_opt(21, 15, 33), LocalResult::None);
+assert_eq!(UTC.ymd_opt(2014, 7, 8).and_hms_opt(21, 15, 33),
+           LocalResult::Single(UTC.ymd(2014, 7, 8).and_hms(21, 15, 33)));
+assert_eq!(UTC.ymd_opt(2014, 7, 8).and_hms_opt(80, 15, 33), LocalResult::None);
+assert_eq!(UTC.ymd_opt(2014, 7, 38).and_hms_opt(21, 15, 33), LocalResult::None);
 
 // other time zone objects can be used to construct a local datetime.
 // obviously, `local_dt` is normally different from `dt`, but `fixed_dt` should be identical.
 let local_dt = Local.ymd(2014, 7, 8).and_hms_milli(9, 10, 11, 12);
 let fixed_dt = FixedOffset::east(9 * 3600).ymd(2014, 7, 8).and_hms_milli(18, 10, 11, 12);
 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://docs.rs/chrono/0.4.6/chrono/trait.Datelike.html) and
-[`Timelike`](https://docs.rs/chrono/0.4.6/chrono/trait.Timelike.html) which you should `use` before.
+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.
 Addition and subtraction is also supported.
 The following illustrates most supported operations to the date and time:
 
-```rust
-use chrono::prelude::*;
-use time::Duration;
+~~~~ {.rust}
+use chrono::*;
 
 // assume this returned `2014-11-28T21:45:59.324310806+09:00`:
 let dt = Local::now();
 
 // property accessors
 assert_eq!((dt.year(), dt.month(), dt.day()), (2014, 11, 28));
 assert_eq!((dt.month0(), dt.day0()), (10, 27)); // for unfortunate souls
 assert_eq!((dt.hour(), dt.minute(), dt.second()), (21, 45, 59));
 assert_eq!(dt.weekday(), Weekday::Fri);
 assert_eq!(dt.weekday().number_from_monday(), 5); // Mon=1, ..., Sat=7
 assert_eq!(dt.ordinal(), 332); // the day of year
 assert_eq!(dt.num_days_from_ce(), 735565); // the number of days from and including Jan 1, 1
 
 // time zone accessor and manipulation
-assert_eq!(dt.offset().fix().local_minus_utc(), 9 * 3600);
+assert_eq!(dt.offset().local_minus_utc(), Duration::hours(9));
 assert_eq!(dt.timezone(), FixedOffset::east(9 * 3600));
-assert_eq!(dt.with_timezone(&Utc), Utc.ymd(2014, 11, 28).and_hms_nano(12, 45, 59, 324310806));
+assert_eq!(dt.with_timezone(&UTC), UTC.ymd(2014, 11, 28).and_hms_nano(12, 45, 59, 324310806));
 
 // a sample of property manipulations (validates dynamically)
 assert_eq!(dt.with_day(29).unwrap().weekday(), Weekday::Sat); // 2014-11-29 is Saturday
 assert_eq!(dt.with_day(32), None);
 assert_eq!(dt.with_year(-300).unwrap().num_days_from_ce(), -109606); // November 29, 301 BCE
 
 // arithmetic operations
-let dt1 = Utc.ymd(2014, 11, 14).and_hms(8, 9, 10);
-let dt2 = Utc.ymd(2014, 11, 14).and_hms(10, 9, 8);
-assert_eq!(dt1.signed_duration_since(dt2), Duration::seconds(-2 * 3600 + 2));
-assert_eq!(dt2.signed_duration_since(dt1), Duration::seconds(2 * 3600 - 2));
-assert_eq!(Utc.ymd(1970, 1, 1).and_hms(0, 0, 0) + Duration::seconds(1_000_000_000),
-           Utc.ymd(2001, 9, 9).and_hms(1, 46, 40));
-assert_eq!(Utc.ymd(1970, 1, 1).and_hms(0, 0, 0) - Duration::seconds(1_000_000_000),
-           Utc.ymd(1938, 4, 24).and_hms(22, 13, 20));
-```
+assert_eq!(UTC.ymd(2014, 11, 14).and_hms(8, 9, 10) - UTC.ymd(2014, 11, 14).and_hms(10, 9, 8),
+           Duration::seconds(-2 * 3600 + 2));
+assert_eq!(UTC.ymd(1970, 1, 1).and_hms(0, 0, 0) + Duration::seconds(1_000_000_000),
+           UTC.ymd(2001, 9, 9).and_hms(1, 46, 40));
+assert_eq!(UTC.ymd(1970, 1, 1).and_hms(0, 0, 0) - Duration::seconds(1_000_000_000),
+           UTC.ymd(1938, 4, 24).and_hms(22, 13, 20));
+~~~~
 
-### Formatting and Parsing
-
-Formatting is done via the [`format`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.format) method,
+Formatting is done via the [`format`](https://lifthrasiir.github.io/rust-chrono/chrono/datetime/struct.DateTime.html#method.format) method,
 which format is equivalent to the familiar `strftime` format.
-
-See [`format::strftime`](https://docs.rs/chrono/0.4.6/chrono/format/strftime/index.html#specifiers)
-documentation for full syntax and list of specifiers.
+(See the [`format::strftime` module documentation](https://lifthrasiir.github.io/rust-chrono/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://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.to_rfc2822) and
-[`to_rfc3339`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.to_rfc3339) methods
+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
 for well-known formats.
 
-```rust
-use chrono::prelude::*;
+~~~~ {.rust}
+use chrono::*;
 
-let dt = Utc.ymd(2014, 11, 28).and_hms(12, 0, 9);
+let dt = UTC.ymd(2014, 11, 28).and_hms(12, 0, 9);
 assert_eq!(dt.format("%Y-%m-%d %H:%M:%S").to_string(), "2014-11-28 12:00:09");
 assert_eq!(dt.format("%a %b %e %T %Y").to_string(), "Fri Nov 28 12:00:09 2014");
 assert_eq!(dt.format("%a %b %e %T %Y").to_string(), dt.format("%c").to_string());
 
 assert_eq!(dt.to_string(), "2014-11-28 12:00:09 UTC");
 assert_eq!(dt.to_rfc2822(), "Fri, 28 Nov 2014 12:00:09 +0000");
 assert_eq!(dt.to_rfc3339(), "2014-11-28T12:00:09+00:00");
 assert_eq!(format!("{:?}", dt), "2014-11-28T12:00:09Z");
-
-// Note that milli/nanoseconds are only printed if they are non-zero
-let dt_nano = Utc.ymd(2014, 11, 28).and_hms_nano(12, 0, 9, 1);
-assert_eq!(format!("{:?}", dt_nano), "2014-11-28T12:00:09.000000001Z");
-```
+~~~~
 
 Parsing can be done with three methods:
 
 1. The standard [`FromStr`](https://doc.rust-lang.org/std/str/trait.FromStr.html) trait
    (and [`parse`](https://doc.rust-lang.org/std/primitive.str.html#method.parse) method
-   on a string) can be used for parsing `DateTime<FixedOffset>`, `DateTime<Utc>` and
+   on a string) can be used for parsing `DateTime<FixedOffset>`, `DateTime<UTC>` and
    `DateTime<Local>` values. This parses what the `{:?}`
    ([`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://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.parse_from_str) parses
+2. [`DateTime::parse_from_str`](https://lifthrasiir.github.io/rust-chrono/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://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.parse_from_rfc2822)
+   [`DateTime::parse_from_rfc2822`](https://lifthrasiir.github.io/rust-chrono/chrono/datetime/struct.DateTime.html#method.parse_from_rfc2822)
    and
-   [`DateTime::parse_from_rfc3339`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.parse_from_rfc3339)
+   [`DateTime::parse_from_rfc3339`](https://lifthrasiir.github.io/rust-chrono/chrono/datetime/struct.DateTime.html#method.parse_from_rfc3339)
    are similar but for well-known formats.
 
-3. [`Offset::datetime_from_str`](https://docs.rs/chrono/0.4.6/chrono/offset/trait.TimeZone.html#method.datetime_from_str) is
+3. [`Offset::datetime_from_str`](https://lifthrasiir.github.io/rust-chrono/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://docs.rs/chrono/0.4.6/chrono/format/index.html) module.
+[`format`](https://lifthrasiir.github.io/rust-chrono/chrono/format/index.html) module.
 
-```rust
-use chrono::prelude::*;
+~~~~ {.rust}
+use chrono::*;
 
-let dt = Utc.ymd(2014, 11, 28).and_hms(12, 0, 9);
+let dt = UTC.ymd(2014, 11, 28).and_hms(12, 0, 9);
 let fixed_dt = dt.with_timezone(&FixedOffset::east(9*3600));
 
 // method 1
-assert_eq!("2014-11-28T12:00:09Z".parse::<DateTime<Utc>>(), Ok(dt.clone()));
-assert_eq!("2014-11-28T21:00:09+09:00".parse::<DateTime<Utc>>(), Ok(dt.clone()));
+assert_eq!("2014-11-28T12:00:09Z".parse::<DateTime<UTC>>(), Ok(dt.clone()));
+assert_eq!("2014-11-28T21:00:09+09:00".parse::<DateTime<UTC>>(), Ok(dt.clone()));
 assert_eq!("2014-11-28T21:00:09+09:00".parse::<DateTime<FixedOffset>>(), Ok(fixed_dt.clone()));
 
 // method 2
 assert_eq!(DateTime::parse_from_str("2014-11-28 21:00:09 +09:00", "%Y-%m-%d %H:%M:%S %z"),
            Ok(fixed_dt.clone()));
 assert_eq!(DateTime::parse_from_rfc2822("Fri, 28 Nov 2014 21:00:09 +0900"),
            Ok(fixed_dt.clone()));
 assert_eq!(DateTime::parse_from_rfc3339("2014-11-28T21:00:09+09:00"), Ok(fixed_dt.clone()));
 
 // method 3
-assert_eq!(Utc.datetime_from_str("2014-11-28 12:00:09", "%Y-%m-%d %H:%M:%S"), Ok(dt.clone()));
-assert_eq!(Utc.datetime_from_str("Fri Nov 28 12:00:09 2014", "%a %b %e %T %Y"), Ok(dt.clone()));
+assert_eq!(UTC.datetime_from_str("2014-11-28 12:00:09", "%Y-%m-%d %H:%M:%S"), Ok(dt.clone()));
+assert_eq!(UTC.datetime_from_str("Fri Nov 28 12:00:09 2014", "%a %b %e %T %Y"), Ok(dt.clone()));
 
 // oops, the year is missing!
-assert!(Utc.datetime_from_str("Fri Nov 28 12:00:09", "%a %b %e %T %Y").is_err());
+assert!(UTC.datetime_from_str("Fri Nov 28 12:00:09", "%a %b %e %T %Y").is_err());
 // oops, the format string does not include the year at all!
-assert!(Utc.datetime_from_str("Fri Nov 28 12:00:09", "%a %b %e %T").is_err());
+assert!(UTC.datetime_from_str("Fri Nov 28 12:00:09", "%a %b %e %T").is_err());
 // oops, the weekday is incorrect!
-assert!(Utc.datetime_from_str("Sat Nov 28 12:00:09 2014", "%a %b %e %T %Y").is_err());
-```
-
-Again : See [`format::strftime`](https://docs.rs/chrono/0.4.6/chrono/format/strftime/index.html#specifiers)
-documentation for full syntax and list of specifiers.
-
-### Conversion from and to EPOCH timestamps
-
-Use [`Utc.timestamp(seconds, nanoseconds)`](https://docs.rs/chrono/0.4.6/chrono/offset/trait.TimeZone.html#method.timestamp)
-to construct a [`DateTime<Utc>`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html) from a UNIX timestamp
-(seconds, nanoseconds that passed since January 1st 1970).
-
-Use [`DateTime.timestamp`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.timestamp) to get the timestamp (in seconds)
-from a [`DateTime`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html). Additionally, you can use
-[`DateTime.timestamp_subsec_nanos`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.timestamp_subsec_nanos)
-to get the number of additional number of nanoseconds.
-
-```rust
-// We need the trait in scope to use Utc::timestamp().
-use chrono::TimeZone;
-
-// Construct a datetime from epoch:
-let dt = Utc.timestamp(1_500_000_000, 0);
-assert_eq!(dt.to_rfc2822(), "Fri, 14 Jul 2017 02:40:00 +0000");
-
-// Get epoch value from a datetime:
-let dt = DateTime::parse_from_rfc2822("Fri, 14 Jul 2017 02:40:00 +0000").unwrap();
-assert_eq!(dt.timestamp(), 1_500_000_000);
-```
+assert!(UTC.datetime_from_str("Sat Nov 28 12:00:09 2014", "%a %b %e %T %Y").is_err());
+~~~~
 
 ### Individual date
 
-Chrono also provides an individual date type ([**`Date`**](https://docs.rs/chrono/0.4.6/chrono/struct.Date.html)).
+Chrono also provides an individual date type ([**`Date`**](https://lifthrasiir.github.io/rust-chrono/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.
 
-```rust
-use chrono::prelude::*;
-use chrono::offset::LocalResult;
+~~~~ {.rust}
+use chrono::*;
 
-assert_eq!(Utc::today(), Utc::now().date());
+assert_eq!(UTC::today(), UTC::now().date());
 assert_eq!(Local::today(), Local::now().date());
 
-assert_eq!(Utc.ymd(2014, 11, 28).weekday(), Weekday::Fri);
-assert_eq!(Utc.ymd_opt(2014, 11, 31), LocalResult::None);
-assert_eq!(Utc.ymd(2014, 11, 28).and_hms_milli(7, 8, 9, 10).format("%H%M%S").to_string(),
+assert_eq!(UTC.ymd(2014, 11, 28).weekday(), Weekday::Fri);
+assert_eq!(UTC.ymd_opt(2014, 11, 31), LocalResult::None);
+assert_eq!(UTC.ymd(2014, 11, 28).and_hms_milli(7, 8, 9, 10).format("%H%M%S").to_string(),
            "070809");
-```
+~~~~
 
 There is no timezone-aware `Time` due to the lack of usefulness and also the complexity.
 
-`DateTime` has [`date`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.date) method
+`DateTime` has [`date`](https://lifthrasiir.github.io/rust-chrono/chrono/datetime/struct.DateTime.html#method.date) method
 which returns a `Date` which represents its date component.
-There is also a [`time`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.time) method,
+There is also a [`time`](https://lifthrasiir.github.io/rust-chrono/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://docs.rs/chrono/0.4.6/chrono/naive/struct.NaiveDate.html),
-[**`NaiveTime`**](https://docs.rs/chrono/0.4.6/chrono/naive/struct.NaiveTime.html) and
-[**`NaiveDateTime`**](https://docs.rs/chrono/0.4.6/chrono/naive/struct.NaiveDateTime.html) respectively.
+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.
 
 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://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.naive_local) returns
+[`naive_local`](https://lifthrasiir.github.io/rust-chrono/chrono/datetime/struct.DateTime.html#method.naive_local) returns
 a view to the naive local time,
-and [`naive_utc`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.naive_utc) returns
+and [`naive_utc`](https://lifthrasiir.github.io/rust-chrono/chrono/datetime/struct.DateTime.html#method.naive_utc) returns
 a view to the naive UTC time.
 
 ## Limitations
 
 Only proleptic Gregorian calendar (i.e. extended to support older dates) is supported.
 Be very careful if you really have to deal with pre-20C dates, they can be in Julian or others.
 
 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://docs.rs/chrono/0.4.6/chrono/naive/struct.NaiveTime.html#leap-second-handling).
+Chrono doesn't try to make use of them](https://lifthrasiir.github.io/rust-chrono/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
 if you want.
 
 Chrono inherently does not support an inaccurate or partial date and time representation.
 Any operation that can be ambiguous will return `None` in such cases.
 For example, "a month later" of 2014-01-30 is not well-defined
-and consequently `Utc.ymd(2014, 1, 30).with_month(2)` returns `None`.
+and consequently `UTC.ymd(2014, 1, 30).with_month(2)` returns `None`.
 
-Advanced time zone handling is not yet supported.
-For now you can try the [Chrono-tz](https://github.com/chronotope/chrono-tz/) crate instead.
+Advanced time zone handling is not yet supported (but is planned in 0.3).
 
deleted file mode 100644
--- a/third_party/rust/chrono/appveyor.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-environment:
-  matrix:
-    - TARGET: 1.13.0-x86_64-pc-windows-gnu
-    - TARGET: nightly-x86_64-pc-windows-msvc
-    - TARGET: nightly-i686-pc-windows-msvc
-    - TARGET: nightly-x86_64-pc-windows-gnu
-    - TARGET: nightly-i686-pc-windows-gnu
-matrix:
-  allow_failures:
-    - channel: nightly
-install:
-  - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-${env:TARGET}.exe" -FileName "rust-install.exe"
-  - ps: .\rust-install.exe /VERYSILENT /NORESTART /DIR="C:\rust" | Out-Null
-  - ps: $env:PATH="$env:PATH;C:\rust\bin"
-  - rustc -vV
-  - cargo -vV
-
-build: false
-
-test_script:
-  - sh -c 'PATH=`rustc --print sysroot`/bin:$PATH ./ci/travis.sh'
deleted file mode 100755
--- a/third_party/rust/chrono/ci/fix-readme.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-
-VERSION="$( cargo read-manifest | python -c 'import json, sys; print(json.load(sys.stdin)["version"])')"
-LIB="$1"
-
-# Make the Chrono in the header a link to the docs
-awk '/^\/\/! # Chrono: / { print "[Chrono][docsrs]:", substr($0, index($0, $4))}' "$LIB"
-awk '/^\/\/! # Chrono: / { print "[Chrono][docsrs]:", substr($0, index($0, $4))}' "$LIB" | sed 's/./=/g'
-# Add all the badges
-echo '
-[![Chrono on Travis CI][travis-image]][travis]
-[![Chrono on Appveyor][appveyor-image]][appveyor]
-[![Chrono on crates.io][cratesio-image]][cratesio]
-[![Chrono on docs.rs][docsrs-image]][docsrs]
-[![Join the chat at https://gitter.im/chrono-rs/chrono][gitter-image]][gitter]
-
-[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
-[docsrs-image]: https://docs.rs/chrono/badge.svg
-[docsrs]: https://docs.rs/chrono
-[gitter-image]: https://badges.gitter.im/chrono-rs/chrono.svg
-[gitter]: https://gitter.im/chrono-rs/chrono'
-
-# print the section between the header and the usage
-awk '/^\/\/! # Chrono:/,/^\/\/! ## /' "$LIB" | cut -b 5- | grep -v '^#' | \
-    sed 's/](\.\//](https:\/\/docs.rs\/chrono\/'$VERSION'\/chrono\//g'
-echo
-# Replace relative doc links with links to this exact version of docs on
-# docs.rs
-awk '/^\/\/! ## /,!/^\/\/!/' "$LIB" | cut -b 5- | grep -v '^# ' | \
-    sed 's/](\.\//](https:\/\/docs.rs\/chrono\/'$VERSION'\/chrono\//g' \
deleted file mode 100755
--- a/third_party/rust/chrono/ci/travis.sh
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/bin/bash
-
-# This is the script that's executed by travis, you can run it yourself to run
-# the exact same suite
-
-set -e
-
-DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-
-channel() {
-    if [ -n "${TRAVIS}" ]; then
-        if [ "${TRAVIS_RUST_VERSION}" = "${CHANNEL}" ]; then
-            pwd
-            (set -x; cargo "$@")
-        fi
-    elif [ -n "${APPVEYOR}" ]; then
-        if [ "${APPVEYOR_RUST_CHANNEL}" = "${CHANNEL}" ]; then
-            pwd
-            (set -x; cargo "$@")
-        fi
-    else
-        pwd
-        (set -x; cargo "+${CHANNEL}" "$@")
-    fi
-}
-
-build_and_test() {
-  # interleave building and testing in hope that it saves time
-  # also vary the local time zone to (hopefully) catch tz-dependent bugs
-  # also avoid doc-testing multiple times---it takes a lot and rarely helps
-  cargo clean
-  channel build -v
-  TZ=ACST-9:30 channel test -v --lib
-  channel build -v --features rustc-serialize
-  TZ=EST4 channel test -v --features rustc-serialize --lib
-  channel build -v --features serde
-  TZ=UTC0 channel test -v --features serde --lib
-  channel build -v --features serde,rustc-serialize
-  TZ=Asia/Katmandu channel test -v --features serde,rustc-serialize
-
-  # without default "clock" feature
-  channel build -v --no-default-features
-  TZ=ACST-9:30 channel test -v --no-default-features --lib
-  channel build -v --no-default-features --features rustc-serialize
-  TZ=EST4 channel test -v --no-default-features --features rustc-serialize --lib
-  channel build -v --no-default-features --features serde
-  TZ=UTC0 channel test -v --no-default-features --features serde --lib
-  channel build -v --no-default-features --features serde,rustc-serialize
-  TZ=Asia/Katmandu channel test -v --no-default-features --features serde,rustc-serialize --lib
-
-  if [[ "$CHANNEL" == stable ]]; then
-      if [[ -n "$TRAVIS" ]] ; then
-          check_readme
-      fi
-  fi
-}
-
-build_only() {
-  # Rust 1.13 doesn't support custom derive, so, to avoid doctests which
-  # validate that, we just build there.
-  cargo clean
-  channel build -v
-  channel build -v --features rustc-serialize
-  channel build -v --features 'serde bincode'
-  channel build -v --no-default-features
-}
-
-run_clippy() {
-    # cached installation will not work on a later nightly
-    if [ -n "${TRAVIS}" ] && ! cargo install clippy --debug --force; then
-        echo "COULD NOT COMPILE CLIPPY, IGNORING CLIPPY TESTS"
-        exit
-    fi
-
-    cargo clippy --features 'serde bincode rustc-serialize' -- -Dclippy
-}
-
-check_readme() {
-    make readme
-    (set -x; git diff --exit-code -- README.md) ; echo $?
-}
-
-rustc --version
-cargo --version
-
-CHANNEL=nightly
-if [ "x${CLIPPY}" = xy ] ; then
-    run_clippy
-else
-    build_and_test
-fi
-
-CHANNEL=beta
-build_and_test
-
-CHANNEL=stable
-build_and_test
-
-CHANNEL=1.13.0
-build_only
--- a/third_party/rust/chrono/src/date.rs
+++ b/third_party/rust/chrono/src/date.rs
@@ -1,29 +1,34 @@
-// This is a part of Chrono.
+// This is a part of rust-chrono.
+// Copyright (c) 2014-2015, Kang Seonghoon.
 // See README.md and LICENSE.txt for details.
 
-//! ISO 8601 calendar date with time zone.
+/*!
+ * ISO 8601 calendar date with time zone.
+ */
 
 use std::{fmt, hash};
 use std::cmp::Ordering;
 use std::ops::{Add, Sub};
-use oldtime::Duration as OldDuration;
 
 use {Weekday, Datelike};
-use offset::{TimeZone, Utc};
-use naive::{self, NaiveDate, NaiveTime, IsoWeek};
-use DateTime;
+use duration::Duration;
+use offset::{TimeZone, Offset};
+use offset::utc::UTC;
+use naive;
+use naive::date::NaiveDate;
+use naive::time::NaiveTime;
+use datetime::DateTime;
 use format::{Item, DelayedFormat, StrftimeItems};
 
 /// ISO 8601 calendar date with time zone.
 ///
 /// This type should be considered ambiguous at best,
 /// due to the inherent lack of precision required for the time zone resolution.
-/// For serialization and deserialization uses, it is best to use `NaiveDate` instead.
 /// There are some guarantees on the usage of `Date<Tz>`:
 ///
 /// - If properly constructed via `TimeZone::ymd` and others without an error,
 ///   the corresponding local date should exist for at least a moment.
 ///   (It may still have a gap from the offset changes.)
 ///
 /// - The `TimeZone` is free to assign *any* `Offset` to the local date,
 ///   as long as that offset did occur in given day.
@@ -40,19 +45,19 @@ use format::{Item, DelayedFormat, Strfti
 ///   even though the raw calculation between `NaiveDate` and `Duration` may not.
 #[derive(Clone)]
 pub struct Date<Tz: TimeZone> {
     date: NaiveDate,
     offset: Tz::Offset,
 }
 
 /// The minimum possible `Date`.
-pub const MIN_DATE: Date<Utc> = Date { date: naive::MIN_DATE, offset: Utc };
+pub const MIN: Date<UTC> = Date { date: naive::date::MIN, offset: UTC };
 /// The maximum possible `Date`.
-pub const MAX_DATE: Date<Utc> = Date { date: naive::MAX_DATE, offset: Utc };
+pub const MAX: Date<UTC> = Date { date: naive::date::MAX, offset: UTC };
 
 impl<Tz: TimeZone> Date<Tz> {
     /// Makes a new `Date` with given *UTC* date and offset.
     /// The local date should be constructed via the `TimeZone` trait.
     //
     // note: this constructor is purposedly not named to `new` to discourage the direct usage.
     #[inline]
     pub fn from_utc(date: NaiveDate, offset: Tz::Offset) -> Date<Tz> {
@@ -179,17 +184,17 @@ impl<Tz: TimeZone> Date<Tz> {
     /// Returns `None` when `self` is the first representable date.
     #[inline]
     pub fn pred_opt(&self) -> Option<Date<Tz>> {
         self.date.pred_opt().map(|date| Date::from_utc(date, self.offset.clone()))
     }
 
     /// Retrieves an associated offset from UTC.
     #[inline]
-    pub fn offset(&self) -> &Tz::Offset {
+    pub fn offset<'a>(&'a self) -> &'a Tz::Offset {
         &self.offset
     }
 
     /// Retrieves an associated time zone.
     #[inline]
     pub fn timezone(&self) -> Tz {
         TimeZone::from_offset(&self.offset)
     }
@@ -200,55 +205,40 @@ impl<Tz: TimeZone> Date<Tz> {
     pub fn with_timezone<Tz2: TimeZone>(&self, tz: &Tz2) -> Date<Tz2> {
         tz.from_utc_date(&self.date)
     }
 
     /// Adds given `Duration` to the current date.
     ///
     /// Returns `None` when it will result in overflow.
     #[inline]
-    pub fn checked_add_signed(self, rhs: OldDuration) -> Option<Date<Tz>> {
-        let date = try_opt!(self.date.checked_add_signed(rhs));
+    pub fn checked_add(self, rhs: Duration) -> Option<Date<Tz>> {
+        let date = try_opt!(self.date.checked_add(rhs));
         Some(Date { date: date, offset: self.offset })
     }
 
     /// Subtracts given `Duration` from the current date.
     ///
     /// Returns `None` when it will result in overflow.
     #[inline]
-    pub fn checked_sub_signed(self, rhs: OldDuration) -> Option<Date<Tz>> {
-        let date = try_opt!(self.date.checked_sub_signed(rhs));
+    pub fn checked_sub(self, rhs: Duration) -> Option<Date<Tz>> {
+        let date = try_opt!(self.date.checked_sub(rhs));
         Some(Date { date: date, offset: self.offset })
     }
 
-    /// Subtracts another `Date` from the current date.
-    /// Returns a `Duration` of integral numbers.
-    ///
-    /// This does not overflow or underflow at all,
-    /// as all possible output fits in the range of `Duration`.
-    #[cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))]
-    #[inline]
-    pub fn signed_duration_since<Tz2: TimeZone>(self, rhs: Date<Tz2>) -> OldDuration {
-        self.date.signed_duration_since(rhs.date)
-    }
-
     /// Returns a view to the naive UTC date.
     #[inline]
     pub fn naive_utc(&self) -> NaiveDate {
         self.date
     }
 
     /// Returns a view to the naive local date.
-    ///
-    /// This is technically same to [`naive_utc`](#method.naive_utc)
-    /// because the offset is restricted to never exceed one day,
-    /// but provided for the consistency.
     #[inline]
     pub fn naive_local(&self) -> NaiveDate {
-        self.date
+        self.date + self.offset.local_minus_utc()
     }
 }
 
 /// Maps the local date to other date with given conversion function.
 fn map_local<Tz: TimeZone, F>(d: &Date<Tz>, mut f: F) -> Option<Date<Tz>>
         where F: FnMut(NaiveDate) -> Option<NaiveDate> {
     f(d.naive_local()).and_then(|date| d.timezone().from_local_date(&date).single())
 }
@@ -257,34 +247,34 @@ impl<Tz: TimeZone> Date<Tz> where Tz::Of
     /// Formats the date with the specified formatting items.
     #[inline]
     pub fn format_with_items<'a, I>(&self, items: I) -> DelayedFormat<I>
             where I: Iterator<Item=Item<'a>> + Clone {
         DelayedFormat::new_with_offset(Some(self.naive_local()), None, &self.offset, items)
     }
 
     /// Formats the date with the specified format string.
-    /// See the [`format::strftime` module](./format/strftime/index.html)
+    /// See the [`format::strftime` module](../format/strftime/index.html)
     /// on the supported escape sequences.
     #[inline]
     pub fn format<'a>(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>> {
         self.format_with_items(StrftimeItems::new(fmt))
     }
 }
 
 impl<Tz: TimeZone> Datelike for Date<Tz> {
     #[inline] fn year(&self) -> i32 { self.naive_local().year() }
     #[inline] fn month(&self) -> u32 { self.naive_local().month() }
     #[inline] fn month0(&self) -> u32 { self.naive_local().month0() }
     #[inline] fn day(&self) -> u32 { self.naive_local().day() }
     #[inline] fn day0(&self) -> u32 { self.naive_local().day0() }
     #[inline] fn ordinal(&self) -> u32 { self.naive_local().ordinal() }
     #[inline] fn ordinal0(&self) -> u32 { self.naive_local().ordinal0() }
     #[inline] fn weekday(&self) -> Weekday { self.naive_local().weekday() }
-    #[inline] fn iso_week(&self) -> IsoWeek { self.naive_local().iso_week() }
+    #[inline] fn isoweekdate(&self) -> (i32, u32, Weekday) { self.naive_local().isoweekdate() }
 
     #[inline]
     fn with_year(&self, year: i32) -> Option<Date<Tz>> {
         map_local(self, |date| date.with_year(year))
     }
 
     #[inline]
     fn with_month(&self, month: u32) -> Option<Date<Tz>> {
@@ -337,47 +327,156 @@ impl<Tz: TimeZone> PartialOrd for Date<T
 impl<Tz: TimeZone> Ord for Date<Tz> {
     fn cmp(&self, other: &Date<Tz>) -> Ordering { self.date.cmp(&other.date) }
 }
 
 impl<Tz: TimeZone> hash::Hash for Date<Tz> {
     fn hash<H: hash::Hasher>(&self, state: &mut H) { self.date.hash(state) }
 }
 
-impl<Tz: TimeZone> Add<OldDuration> for Date<Tz> {
+impl<Tz: TimeZone> Add<Duration> for Date<Tz> {
     type Output = Date<Tz>;
 
     #[inline]
-    fn add(self, rhs: OldDuration) -> Date<Tz> {
-        self.checked_add_signed(rhs).expect("`Date + Duration` overflowed")
+    fn add(self, rhs: Duration) -> Date<Tz> {
+        self.checked_add(rhs).expect("`Date + Duration` overflowed")
     }
 }
 
-impl<Tz: TimeZone> Sub<OldDuration> for Date<Tz> {
+impl<Tz: TimeZone, Tz2: TimeZone> Sub<Date<Tz2>> for Date<Tz> {
+    type Output = Duration;
+
+    #[inline]
+    fn sub(self, rhs: Date<Tz2>) -> Duration { self.date - rhs.date }
+}
+
+impl<Tz: TimeZone> Sub<Duration> for Date<Tz> {
     type Output = Date<Tz>;
 
     #[inline]
-    fn sub(self, rhs: OldDuration) -> Date<Tz> {
-        self.checked_sub_signed(rhs).expect("`Date - Duration` overflowed")
-    }
-}
-
-impl<Tz: TimeZone> Sub<Date<Tz>> for Date<Tz> {
-    type Output = OldDuration;
-
-    #[inline]
-    fn sub(self, rhs: Date<Tz>) -> OldDuration {
-        self.signed_duration_since(rhs)
+    fn sub(self, rhs: Duration) -> Date<Tz> {
+        self.checked_sub(rhs).expect("`Date - Duration` overflowed")
     }
 }
 
 impl<Tz: TimeZone> fmt::Debug for Date<Tz> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         write!(f, "{:?}{:?}", self.naive_local(), self.offset)
     }
 }
 
 impl<Tz: TimeZone> fmt::Display for Date<Tz> where Tz::Offset: fmt::Display {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         write!(f, "{}{}", self.naive_local(), self.offset)
     }
 }
 
+#[cfg(feature = "rustc-serialize")]
+mod rustc_serialize {
+    use super::Date;
+    use offset::TimeZone;
+    use rustc_serialize::{Encodable, Encoder, Decodable, Decoder};
+
+    // TODO the current serialization format is NEVER intentionally defined.
+    // in the future it is likely to be redefined to more sane and reasonable format.
+
+    impl<Tz: TimeZone> Encodable for Date<Tz> where Tz::Offset: Encodable {
+        fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
+            s.emit_struct("Date", 2, |s| {
+                try!(s.emit_struct_field("date", 0, |s| self.date.encode(s)));
+                try!(s.emit_struct_field("offset", 1, |s| self.offset.encode(s)));
+                Ok(())
+            })
+        }
+    }
+
+    impl<Tz: TimeZone> Decodable for Date<Tz> where Tz::Offset: Decodable {
+        fn decode<D: Decoder>(d: &mut D) -> Result<Date<Tz>, D::Error> {
+            d.read_struct("Date", 2, |d| {
+                let date = try!(d.read_struct_field("date", 0, Decodable::decode));
+                let offset = try!(d.read_struct_field("offset", 1, Decodable::decode));
+                Ok(Date::from_utc(date, offset))
+            })
+        }
+    }
+
+    #[test]
+    fn test_encodable() {
+        use offset::utc::UTC;
+        use rustc_serialize::json::encode;
+
+        assert_eq!(encode(&UTC.ymd(2014, 7, 24)).ok(),
+                   Some(r#"{"date":{"ymdf":16501977},"offset":{}}"#.into()));
+    }
+
+    #[test]
+    fn test_decodable() {
+        use offset::utc::UTC;
+        use rustc_serialize::json;
+
+        let decode = |s: &str| json::decode::<Date<UTC>>(s);
+
+        assert_eq!(decode(r#"{"date":{"ymdf":16501977},"offset":{}}"#).ok(),
+                   Some(UTC.ymd(2014, 7, 24)));
+
+        assert!(decode(r#"{"date":{"ymdf":0},"offset":{}}"#).is_err());
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use std::fmt;
+
+    use Datelike;
+    use duration::Duration;
+    use naive::date::NaiveDate;
+    use naive::datetime::NaiveDateTime;
+    use offset::{TimeZone, Offset, LocalResult};
+    use offset::local::Local;
+
+    #[derive(Copy, Clone, PartialEq, Eq)]
+    struct UTC1y; // same to UTC but with an offset of 365 days
+
+    #[derive(Copy, Clone, PartialEq, Eq)]
+    struct OneYear;
+
+    impl TimeZone for UTC1y {
+        type Offset = OneYear;
+
+        fn from_offset(_offset: &OneYear) -> UTC1y { UTC1y }
+
+        fn offset_from_local_date(&self, _local: &NaiveDate) -> LocalResult<OneYear> {
+            LocalResult::Single(OneYear)
+        }
+        fn offset_from_local_datetime(&self, _local: &NaiveDateTime) -> LocalResult<OneYear> {
+            LocalResult::Single(OneYear)
+        }
+
+        fn offset_from_utc_date(&self, _utc: &NaiveDate) -> OneYear { OneYear }
+        fn offset_from_utc_datetime(&self, _utc: &NaiveDateTime) -> OneYear { OneYear }
+    }
+
+    impl Offset for OneYear {
+        fn local_minus_utc(&self) -> Duration { Duration::days(365) }
+    }
+
+    impl fmt::Debug for OneYear {
+        fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "+8760:00") }
+    }
+
+    #[test]
+    fn test_date_weird_offset() {
+        assert_eq!(format!("{:?}", UTC1y.ymd(2012, 2, 29)),
+                   "2012-02-29+8760:00".to_string());
+        assert_eq!(format!("{:?}", UTC1y.ymd(2012, 2, 29).and_hms(5, 6, 7)),
+                   "2012-02-29T05:06:07+8760:00".to_string());
+        assert_eq!(format!("{:?}", UTC1y.ymd(2012, 3, 4)),
+                   "2012-03-04+8760:00".to_string());
+        assert_eq!(format!("{:?}", UTC1y.ymd(2012, 3, 4).and_hms(5, 6, 7)),
+                   "2012-03-04T05:06:07+8760:00".to_string());
+    }
+
+    #[test]
+    fn test_local_date_sanity_check() { // issue #27
+        assert_eq!(Local.ymd(2999, 12, 28).day(), 28);
+    }
+}
+
--- a/third_party/rust/chrono/src/datetime.rs
+++ b/third_party/rust/chrono/src/datetime.rs
@@ -1,82 +1,42 @@
-// This is a part of Chrono.
+// This is a part of rust-chrono.
+// Copyright (c) 2014-2015, Kang Seonghoon.
 // See README.md and LICENSE.txt for details.
 
-//! ISO 8601 date and time with time zone.
+/*!
+ * ISO 8601 date and time with time zone.
+ */
 
 use std::{str, fmt, hash};
 use std::cmp::Ordering;
 use std::ops::{Add, Sub};
-use std::time::{SystemTime, UNIX_EPOCH};
-use oldtime::Duration as OldDuration;
 
 use {Weekday, Timelike, Datelike};
-#[cfg(feature="clock")]
-use offset::Local;
-use offset::{TimeZone, Offset, Utc, FixedOffset};
-use naive::{NaiveTime, NaiveDateTime, IsoWeek};
-use Date;
+use offset::{TimeZone, Offset};
+use offset::utc::UTC;
+use offset::local::Local;
+use offset::fixed::FixedOffset;
+use duration::Duration;
+use naive::time::NaiveTime;
+use naive::datetime::NaiveDateTime;
+use date::Date;
 use format::{Item, Numeric, Pad, Fixed};
 use format::{parse, Parsed, ParseError, ParseResult, DelayedFormat, StrftimeItems};
 
-/// Specific formatting options for seconds. This may be extended in the
-/// future, so exhaustive matching in external code is not recommended.
-///
-/// See the `TimeZone::to_rfc3339_opts` function for usage.
-#[derive(Clone, Copy, Debug, Eq, PartialEq)]
-pub enum SecondsFormat {
-    /// Format whole seconds only, with no decimal point nor subseconds.
-    Secs,
-
-    /// Use fixed 3 subsecond digits. This corresponds to
-    /// [Fixed::Nanosecond3](format/enum.Fixed.html#variant.Nanosecond3).
-    Millis,
-
-    /// Use fixed 6 subsecond digits. This corresponds to
-    /// [Fixed::Nanosecond6](format/enum.Fixed.html#variant.Nanosecond6).
-    Micros,
-
-    /// Use fixed 9 subsecond digits. This corresponds to
-    /// [Fixed::Nanosecond9](format/enum.Fixed.html#variant.Nanosecond9).
-    Nanos,
-
-    /// Automatically select one of `Secs`, `Millis`, `Micros`, or `Nanos` to
-    /// display all available non-zero sub-second digits.  This corresponds to
-    /// [Fixed::Nanosecond](format/enum.Fixed.html#variant.Nanosecond).
-    AutoSi,
-
-    // Do not match against this.
-    #[doc(hidden)]
-    __NonExhaustive,
-}
-
 /// ISO 8601 combined date and time with time zone.
-///
-/// There are some constructors implemented here (the `from_*` methods), but
-/// the general-purpose constructors are all via the methods on the
-/// [`TimeZone`](./offset/trait.TimeZone.html) implementations.
 #[derive(Clone)]
 pub struct DateTime<Tz: TimeZone> {
     datetime: NaiveDateTime,
     offset: Tz::Offset,
 }
 
 impl<Tz: TimeZone> DateTime<Tz> {
     /// Makes a new `DateTime` with given *UTC* datetime and offset.
     /// The local datetime should be constructed via the `TimeZone` trait.
-    ///
-    /// # Example
-    ///
-    /// ~~~~
-    /// use chrono::{DateTime, TimeZone, NaiveDateTime, Utc};
-    ///
-    /// let dt = DateTime::<Utc>::from_utc(NaiveDateTime::from_timestamp(61, 0), Utc);
-    /// assert_eq!(Utc.timestamp(61, 0), dt);
-    /// ~~~~
     //
     // note: this constructor is purposedly not named to `new` to discourage the direct usage.
     #[inline]
     pub fn from_utc(datetime: NaiveDateTime, offset: Tz::Offset) -> DateTime<Tz> {
         DateTime { datetime: datetime, offset: offset }
     }
 
     /// Retrieves a date component.
@@ -84,74 +44,26 @@ impl<Tz: TimeZone> DateTime<Tz> {
     pub fn date(&self) -> Date<Tz> {
         Date::from_utc(self.naive_local().date(), self.offset.clone())
     }
 
     /// Retrieves a time component.
     /// Unlike `date`, this is not associated to the time zone.
     #[inline]
     pub fn time(&self) -> NaiveTime {
-        self.datetime.time() + self.offset.fix()
+        self.datetime.time() + self.offset.local_minus_utc()
     }
 
     /// Returns the number of non-leap seconds since January 1, 1970 0:00:00 UTC
     /// (aka "UNIX timestamp").
     #[inline]
     pub fn timestamp(&self) -> i64 {
         self.datetime.timestamp()
     }
 
-    /// Returns the number of non-leap-milliseconds since January 1, 1970 UTC
-    ///
-    /// Note that this does reduce the number of years that can be represented
-    /// from ~584 Billion to ~584 Million. (If this is a problem, please file
-    /// an issue to let me know what domain needs millisecond precision over
-    /// billions of years, I'm curious.)
-    ///
-    /// # Example
-    ///
-    /// ~~~~
-    /// use chrono::Utc;
-    /// use chrono::TimeZone;
-    ///
-    /// let dt = Utc.ymd(1970, 1, 1).and_hms_milli(0, 0, 1, 444);
-    /// assert_eq!(dt.timestamp_millis(), 1_444);
-    ///
-    /// let dt = Utc.ymd(2001, 9, 9).and_hms_milli(1, 46, 40, 555);
-    /// assert_eq!(dt.timestamp_millis(), 1_000_000_000_555);
-    /// ~~~~
-    #[inline]
-    pub fn timestamp_millis(&self) -> i64 {
-        self.datetime.timestamp_millis()
-    }
-
-    /// Returns the number of non-leap-nanoseconds since January 1, 1970 UTC
-    ///
-    /// Note that this does reduce the number of years that can be represented
-    /// from ~584 Billion to ~584. (If this is a problem, please file
-    /// an issue to let me know what domain needs nanosecond precision over
-    /// millenia, I'm curious.)
-    ///
-    /// # Example
-    ///
-    /// ~~~~
-    /// use chrono::Utc;
-    /// use chrono::TimeZone;
-    ///
-    /// let dt = Utc.ymd(1970, 1, 1).and_hms_nano(0, 0, 1, 444);
-    /// assert_eq!(dt.timestamp_nanos(), 1_000_000_444);
-    ///
-    /// let dt = Utc.ymd(2001, 9, 9).and_hms_nano(1, 46, 40, 555);
-    /// assert_eq!(dt.timestamp_nanos(), 1_000_000_000_000_000_555);
-    /// ~~~~
-    #[inline]
-    pub fn timestamp_nanos(&self) -> i64 {
-        self.datetime.timestamp_nanos()
-    }
-
     /// Returns the number of milliseconds since the last second boundary
     ///
     /// warning: in event of a leap second, this may exceed 999
     ///
     /// note: this is not the number of milliseconds since January 1, 1970 0:00:00 UTC
     #[inline]
     pub fn timestamp_subsec_millis(&self) -> u32 {
         self.datetime.timestamp_subsec_millis()
@@ -172,19 +84,25 @@ impl<Tz: TimeZone> DateTime<Tz> {
     /// warning: in event of a leap second, this may exceed 999_999_999
     ///
     /// note: this is not the number of nanoseconds since January 1, 1970 0:00:00 UTC
     #[inline]
     pub fn timestamp_subsec_nanos(&self) -> u32 {
         self.datetime.timestamp_subsec_nanos()
     }
 
+    /// *Deprecated*: Same to `DateTime::timestamp`.
+    #[inline]
+    pub fn num_seconds_from_unix_epoch(&self) -> i64 {
+        self.timestamp()
+    }
+
     /// Retrieves an associated offset from UTC.
     #[inline]
-    pub fn offset(&self) -> &Tz::Offset {
+    pub fn offset<'a>(&'a self) -> &'a Tz::Offset {
         &self.offset
     }
 
     /// Retrieves an associated time zone.
     #[inline]
     pub fn timezone(&self) -> Tz {
         TimeZone::from_offset(&self.offset)
     }
@@ -195,48 +113,40 @@ impl<Tz: TimeZone> DateTime<Tz> {
     pub fn with_timezone<Tz2: TimeZone>(&self, tz: &Tz2) -> DateTime<Tz2> {
         tz.from_utc_datetime(&self.datetime)
     }
 
     /// Adds given `Duration` to the current date and time.
     ///
     /// Returns `None` when it will result in overflow.
     #[inline]
-    pub fn checked_add_signed(self, rhs: OldDuration) -> Option<DateTime<Tz>> {
-        let datetime = try_opt!(self.datetime.checked_add_signed(rhs));
+    pub fn checked_add(self, rhs: Duration) -> Option<DateTime<Tz>> {
+        let datetime = try_opt!(self.datetime.checked_add(rhs));
         Some(DateTime { datetime: datetime, offset: self.offset })
     }
 
     /// Subtracts given `Duration` from the current date and time.
     ///
     /// Returns `None` when it will result in overflow.
     #[inline]
-    pub fn checked_sub_signed(self, rhs: OldDuration) -> Option<DateTime<Tz>> {
-        let datetime = try_opt!(self.datetime.checked_sub_signed(rhs));
+    pub fn checked_sub(self, rhs: Duration) -> Option<DateTime<Tz>> {
+        let datetime = try_opt!(self.datetime.checked_sub(rhs));
         Some(DateTime { datetime: datetime, offset: self.offset })
     }
 
-    /// Subtracts another `DateTime` from the current date and time.
-    /// This does not overflow or underflow at all.
-    #[cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))]
-    #[inline]
-    pub fn signed_duration_since<Tz2: TimeZone>(self, rhs: DateTime<Tz2>) -> OldDuration {
-        self.datetime.signed_duration_since(rhs.datetime)
-    }
-
     /// Returns a view to the naive UTC datetime.
     #[inline]
     pub fn naive_utc(&self) -> NaiveDateTime {
         self.datetime
     }
 
     /// Returns a view to the naive local datetime.
     #[inline]
     pub fn naive_local(&self) -> NaiveDateTime {
-        self.datetime + self.offset.fix()
+        self.datetime + self.offset.local_minus_utc()
     }
 }
 
 /// Maps the local datetime to other datetime with given conversion function.
 fn map_local<Tz: TimeZone, F>(dt: &DateTime<Tz>, mut f: F) -> Option<DateTime<Tz>>
         where F: FnMut(NaiveDateTime) -> Option<NaiveDateTime> {
     f(dt.naive_local()).and_then(|datetime| dt.timezone().from_local_datetime(&datetime).single())
 }
@@ -260,34 +170,20 @@ impl DateTime<FixedOffset> {
         const ITEMS: &'static [Item<'static>] = &[Item::Fixed(Fixed::RFC3339)];
         let mut parsed = Parsed::new();
         try!(parse(&mut parsed, s, ITEMS.iter().cloned()));
         parsed.to_datetime()
     }
 
     /// Parses a string with the specified format string and
     /// returns a new `DateTime` with a parsed `FixedOffset`.
-    /// See the [`format::strftime` module](./format/strftime/index.html)
+    /// See the [`format::strftime` module](../format/strftime/index.html)
     /// on the supported escape sequences.
     ///
     /// See also `Offset::datetime_from_str` which gives a local `DateTime` on specific time zone.
-    ///
-    /// Note that this method *requires a timezone* in the string. See
-    /// [`NaiveDateTime::parse_from_str`](./naive/struct.NaiveDateTime.html#method.parse_from_str)
-    /// for a version that does not require a timezone in the to-be-parsed str.
-    ///
-    /// # Example
-    ///
-    /// ```rust
-    /// use chrono::{DateTime, FixedOffset, TimeZone};
-    ///
-    /// let dt = DateTime::parse_from_str(
-    ///     "1983 Apr 13 12:09:14.274 +0000", "%Y %b %d %H:%M:%S%.3f %z");
-    /// assert_eq!(dt, Ok(FixedOffset::east(0).ymd(1983, 4, 13).and_hms_milli(12, 9, 14, 274)));
-    /// ```
     pub fn parse_from_str(s: &str, fmt: &str) -> ParseResult<DateTime<FixedOffset>> {
         let mut parsed = Parsed::new();
         try!(parse(&mut parsed, s, StrftimeItems::new(fmt)));
         parsed.to_datetime()
     }
 }
 
 impl<Tz: TimeZone> DateTime<Tz> where Tz::Offset: fmt::Display {
@@ -298,117 +194,43 @@ impl<Tz: TimeZone> DateTime<Tz> where Tz
     }
 
     /// Returns an RFC 3339 and ISO 8601 date and time string such as `1996-12-19T16:39:57-08:00`.
     pub fn to_rfc3339(&self) -> String {
         const ITEMS: &'static [Item<'static>] = &[Item::Fixed(Fixed::RFC3339)];
         self.format_with_items(ITEMS.iter().cloned()).to_string()
     }
 
-    /// Return an RFC 3339 and ISO 8601 date and time string with subseconds
-    /// formatted as per a `SecondsFormat`. If passed `use_z` true and the
-    /// timezone is UTC (offset 0), use 'Z', as per
-    /// [Fixed::TimezoneOffsetColonZ](format/enum.Fixed.html#variant.TimezoneOffsetColonZ).
-    /// If passed `use_z` false, use
-    /// [Fixed::TimezoneOffsetColon](format/enum.Fixed.html#variant.TimezoneOffsetColon).
-    ///
-    /// # Examples
-    ///
-    /// ```rust
-    /// # use chrono::{DateTime, FixedOffset, SecondsFormat, TimeZone, Utc};
-    /// let dt = Utc.ymd(2018, 1, 26).and_hms_micro(18, 30, 9, 453_829);
-    /// assert_eq!(dt.to_rfc3339_opts(SecondsFormat::Millis, false),
-    ///            "2018-01-26T18:30:09.453+00:00");
-    /// assert_eq!(dt.to_rfc3339_opts(SecondsFormat::Millis, true),
-    ///            "2018-01-26T18:30:09.453Z");
-    /// assert_eq!(dt.to_rfc3339_opts(SecondsFormat::Secs, true),
-    ///            "2018-01-26T18:30:09Z");
-    ///
-    /// let pst = FixedOffset::east(8 * 60 * 60);
-    /// let dt = pst.ymd(2018, 1, 26).and_hms_micro(10, 30, 9, 453_829);
-    /// assert_eq!(dt.to_rfc3339_opts(SecondsFormat::Secs, true),
-    ///            "2018-01-26T10:30:09+08:00");
-    /// ```
-    pub fn to_rfc3339_opts(&self, secform: SecondsFormat, use_z: bool) -> String {
-        use format::Numeric::*;
-        use format::Pad::Zero;
-        use SecondsFormat::*;
-
-        debug_assert!(secform != __NonExhaustive, "Do not use __NonExhaustive!");
-
-        const PREFIX: &'static [Item<'static>] = &[
-            Item::Numeric(Year, Zero),
-            Item::Literal("-"),
-            Item::Numeric(Month, Zero),
-            Item::Literal("-"),
-            Item::Numeric(Day, Zero),
-            Item::Literal("T"),
-            Item::Numeric(Hour, Zero),
-            Item::Literal(":"),
-            Item::Numeric(Minute, Zero),
-            Item::Literal(":"),
-            Item::Numeric(Second, Zero),
-        ];
-
-        let ssitem = match secform {
-            Secs   => None,
-            Millis => Some(Item::Fixed(Fixed::Nanosecond3)),
-            Micros => Some(Item::Fixed(Fixed::Nanosecond6)),
-            Nanos  => Some(Item::Fixed(Fixed::Nanosecond9)),
-            AutoSi => Some(Item::Fixed(Fixed::Nanosecond)),
-            __NonExhaustive => unreachable!(),
-        };
-
-        let tzitem = Item::Fixed(
-            if use_z {
-                Fixed::TimezoneOffsetColonZ
-            } else {
-                Fixed::TimezoneOffsetColon
-            }
-        );
-
-        match ssitem {
-            None =>
-                self.format_with_items(
-                    PREFIX.iter().chain([tzitem].iter()).cloned()
-                ).to_string(),
-            Some(s) =>
-                self.format_with_items(
-                    PREFIX.iter().chain([s, tzitem].iter()).cloned()
-                ).to_string(),
-        }
-    }
-
     /// Formats the combined date and time with the specified formatting items.
     #[inline]
     pub fn format_with_items<'a, I>(&self, items: I) -> DelayedFormat<I>
             where I: Iterator<Item=Item<'a>> + Clone {
         let local = self.naive_local();
         DelayedFormat::new_with_offset(Some(local.date()), Some(local.time()), &self.offset, items)
     }
 
     /// Formats the combined date and time with the specified format string.
-    /// See the [`format::strftime` module](./format/strftime/index.html)
+    /// See the [`format::strftime` module](../format/strftime/index.html)
     /// on the supported escape sequences.
     #[inline]
     pub fn format<'a>(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>> {
         self.format_with_items(StrftimeItems::new(fmt))
     }
 }
 
 impl<Tz: TimeZone> Datelike for DateTime<Tz> {
     #[inline] fn year(&self) -> i32 { self.naive_local().year() }
     #[inline] fn month(&self) -> u32 { self.naive_local().month() }
     #[inline] fn month0(&self) -> u32 { self.naive_local().month0() }
     #[inline] fn day(&self) -> u32 { self.naive_local().day() }
     #[inline] fn day0(&self) -> u32 { self.naive_local().day0() }
     #[inline] fn ordinal(&self) -> u32 { self.naive_local().ordinal() }
     #[inline] fn ordinal0(&self) -> u32 { self.naive_local().ordinal0() }
     #[inline] fn weekday(&self) -> Weekday { self.naive_local().weekday() }
-    #[inline] fn iso_week(&self) -> IsoWeek { self.naive_local().iso_week() }
+    #[inline] fn isoweekdate(&self) -> (i32, u32, Weekday) { self.naive_local().isoweekdate() }
 
     #[inline]
     fn with_year(&self, year: i32) -> Option<DateTime<Tz>> {
         map_local(self, |datetime| datetime.with_year(year))
     }
 
     #[inline]
     fn with_month(&self, month: u32) -> Option<DateTime<Tz>> {
@@ -488,40 +310,38 @@ impl<Tz: TimeZone> PartialOrd for DateTi
 impl<Tz: TimeZone> Ord for DateTime<Tz> {
     fn cmp(&self, other: &DateTime<Tz>) -> Ordering { self.datetime.cmp(&other.datetime) }
 }
 
 impl<Tz: TimeZone> hash::Hash for DateTime<Tz> {
     fn hash<H: hash::Hasher>(&self, state: &mut H) { self.datetime.hash(state) }
 }
 
-impl<Tz: TimeZone> Add<OldDuration> for DateTime<Tz> {
+impl<Tz: TimeZone> Add<Duration> for DateTime<Tz> {
     type Output = DateTime<Tz>;
 
     #[inline]
-    fn add(self, rhs: OldDuration) -> DateTime<Tz> {
-        self.checked_add_signed(rhs).expect("`DateTime + Duration` overflowed")
+    fn add(self, rhs: Duration) -> DateTime<Tz> {
+        self.checked_add(rhs).expect("`DateTime + Duration` overflowed")
     }
 }
 
-impl<Tz: TimeZone> Sub<OldDuration> for DateTime<Tz> {
+impl<Tz: TimeZone, Tz2: TimeZone> Sub<DateTime<Tz2>> for DateTime<Tz> {
+    type Output = Duration;
+
+    #[inline]
+    fn sub(self, rhs: DateTime<Tz2>) -> Duration { self.datetime - rhs.datetime }
+}
+
+impl<Tz: TimeZone> Sub<Duration> for DateTime<Tz> {
     type Output = DateTime<Tz>;
 
     #[inline]
-    fn sub(self, rhs: OldDuration) -> DateTime<Tz> {
-        self.checked_sub_signed(rhs).expect("`DateTime - Duration` overflowed")
-    }
-}
-
-impl<Tz: TimeZone> Sub<DateTime<Tz>> for DateTime<Tz> {
-    type Output = OldDuration;
-
-    #[inline]
-    fn sub(self, rhs: DateTime<Tz>) -> OldDuration {
-        self.signed_duration_since(rhs)
+    fn sub(self, rhs: Duration) -> DateTime<Tz> {
+        self.checked_sub(rhs).expect("`DateTime - Duration` overflowed")
     }
 }
 
 impl<Tz: TimeZone> fmt::Debug for DateTime<Tz> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         write!(f, "{:?}{:?}", self.naive_local(), self.offset)
     }
 }
@@ -554,914 +374,231 @@ impl str::FromStr for DateTime<FixedOffs
         ];
 
         let mut parsed = Parsed::new();
         try!(parse(&mut parsed, s, ITEMS.iter().cloned()));
         parsed.to_datetime()
     }
 }
 
-impl str::FromStr for DateTime<Utc> {
+impl str::FromStr for DateTime<UTC> {
     type Err = ParseError;
 
-    fn from_str(s: &str) -> ParseResult<DateTime<Utc>> {
-        s.parse::<DateTime<FixedOffset>>().map(|dt| dt.with_timezone(&Utc))
+    fn from_str(s: &str) -> ParseResult<DateTime<UTC>> {
+        s.parse::<DateTime<FixedOffset>>().map(|dt| dt.with_timezone(&UTC))
     }
 }
 
-#[cfg(feature="clock")]
 impl str::FromStr for DateTime<Local> {
     type Err = ParseError;
 
     fn from_str(s: &str) -> ParseResult<DateTime<Local>> {
         s.parse::<DateTime<FixedOffset>>().map(|dt| dt.with_timezone(&Local))
     }
 }
 
-impl From<SystemTime> for DateTime<Utc> {
-    fn from(t: SystemTime) -> DateTime<Utc> {
-        let (sec, nsec) = match t.duration_since(UNIX_EPOCH) {
-            Ok(dur) => (dur.as_secs() as i64, dur.subsec_nanos()),
-            Err(e) => { // unlikely but should be handled
-                let dur = e.duration();
-                let (sec, nsec) = (dur.as_secs() as i64, dur.subsec_nanos());
-                if nsec == 0 {
-                    (-sec, 0)
-                } else {
-                    (-sec - 1, 1_000_000_000 - nsec)
-                }
-            },
-        };
-        Utc.timestamp(sec, nsec)
-    }
-}
-
-#[cfg(feature="clock")]
-impl From<SystemTime> for DateTime<Local> {
-    fn from(t: SystemTime) -> DateTime<Local> {
-        DateTime::<Utc>::from(t).with_timezone(&Local)
-    }
-}
-
-impl<Tz: TimeZone> From<DateTime<Tz>> for SystemTime {
-    fn from(dt: DateTime<Tz>) -> SystemTime {
-        use std::time::Duration;
-
-        let sec = dt.timestamp();
-        let nsec = dt.timestamp_subsec_nanos();
-        if sec < 0 {
-            // unlikely but should be handled
-            UNIX_EPOCH - Duration::new(-sec as u64, 0) + Duration::new(0, nsec)
-        } else {
-            UNIX_EPOCH + Duration::new(sec as u64, nsec)
-        }
-    }
-}
-
-#[cfg(all(test, any(feature = "rustc-serialize", feature = "serde")))]
-fn test_encodable_json<FUtc, FFixed, E>(to_string_utc: FUtc, to_string_fixed: FFixed)
-    where FUtc: Fn(&DateTime<Utc>) -> Result<String, E>,
-          FFixed: Fn(&DateTime<FixedOffset>) -> Result<String, E>,
-          E: ::std::fmt::Debug
-{
-    assert_eq!(to_string_utc(&Utc.ymd(2014, 7, 24).and_hms(12, 34, 6)).ok(),
-               Some(r#""2014-07-24T12:34:06Z""#.into()));
-
-    assert_eq!(to_string_fixed(&FixedOffset::east(3660).ymd(2014, 7, 24).and_hms(12, 34, 6)).ok(),
-               Some(r#""2014-07-24T12:34:06+01:01""#.into()));
-    assert_eq!(to_string_fixed(&FixedOffset::east(3650).ymd(2014, 7, 24).and_hms(12, 34, 6)).ok(),
-               Some(r#""2014-07-24T12:34:06+01:00:50""#.into()));
-}
-
-#[cfg(all(test, feature="clock", any(feature = "rustc-serialize", feature = "serde")))]
-fn test_decodable_json<FUtc, FFixed, FLocal, E>(utc_from_str: FUtc,
-                                                fixed_from_str: FFixed,
-                                                local_from_str: FLocal)
-    where FUtc: Fn(&str) -> Result<DateTime<Utc>, E>,
-          FFixed: Fn(&str) -> Result<DateTime<FixedOffset>, E>,
-          FLocal: Fn(&str) -> Result<DateTime<Local>, E>,
-          E: ::std::fmt::Debug
-{
-    // should check against the offset as well (the normal DateTime comparison will ignore them)
-    fn norm<Tz: TimeZone>(dt: &Option<DateTime<Tz>>) -> Option<(&DateTime<Tz>, &Tz::Offset)> {
-        dt.as_ref().map(|dt| (dt, dt.offset()))
-    }
-
-    assert_eq!(norm(&utc_from_str(r#""2014-07-24T12:34:06Z""#).ok()),
-               norm(&Some(Utc.ymd(2014, 7, 24).and_hms(12, 34, 6))));
-    assert_eq!(norm(&utc_from_str(r#""2014-07-24T13:57:06+01:23""#).ok()),
-               norm(&Some(Utc.ymd(2014, 7, 24).and_hms(12, 34, 6))));
-
-    assert_eq!(norm(&fixed_from_str(r#""2014-07-24T12:34:06Z""#).ok()),
-               norm(&Some(FixedOffset::east(0).ymd(2014, 7, 24).and_hms(12, 34, 6))));
-    assert_eq!(norm(&fixed_from_str(r#""2014-07-24T13:57:06+01:23""#).ok()),
-               norm(&Some(FixedOffset::east(60*60 + 23*60).ymd(2014, 7, 24).and_hms(13, 57, 6))));
-
-    // we don't know the exact local offset but we can check that
-    // the conversion didn't change the instant itself
-    assert_eq!(local_from_str(r#""2014-07-24T12:34:06Z""#)
-                   .expect("local shouuld parse"),
-               Utc.ymd(2014, 7, 24).and_hms(12, 34, 6));
-    assert_eq!(local_from_str(r#""2014-07-24T13:57:06+01:23""#)
-                   .expect("local should parse with offset"),
-               Utc.ymd(2014, 7, 24).and_hms(12, 34, 6));
-
-    assert!(utc_from_str(r#""2014-07-32T12:34:06Z""#).is_err());
-    assert!(fixed_from_str(r#""2014-07-32T12:34:06Z""#).is_err());
-}
-
-#[cfg(all(test, feature="clock", feature = "rustc-serialize"))]
-fn test_decodable_json_timestamps<FUtc, FFixed, FLocal, E>(utc_from_str: FUtc,
-                                                           fixed_from_str: FFixed,
-                                                           local_from_str: FLocal)
-    where FUtc: Fn(&str) -> Result<rustc_serialize::TsSeconds<Utc>, E>,
-          FFixed: Fn(&str) -> Result<rustc_serialize::TsSeconds<FixedOffset>, E>,
-          FLocal: Fn(&str) -> Result<rustc_serialize::TsSeconds<Local>, E>,
-          E: ::std::fmt::Debug
-{
-    fn norm<Tz: TimeZone>(dt: &Option<DateTime<Tz>>) -> Option<(&DateTime<Tz>, &Tz::Offset)> {
-        dt.as_ref().map(|dt| (dt, dt.offset()))
-    }
-
-    assert_eq!(norm(&utc_from_str("0").ok().map(DateTime::from)),
-               norm(&Some(Utc.ymd(1970, 1, 1).and_hms(0, 0, 0))));
-    assert_eq!(norm(&utc_from_str("-1").ok().map(DateTime::from)),
-               norm(&Some(Utc.ymd(1969, 12, 31).and_hms(23, 59, 59))));
-
-    assert_eq!(norm(&fixed_from_str("0").ok().map(DateTime::from)),
-               norm(&Some(FixedOffset::east(0).ymd(1970, 1, 1).and_hms(0, 0, 0))));
-    assert_eq!(norm(&fixed_from_str("-1").ok().map(DateTime::from)),
-               norm(&Some(FixedOffset::east(0).ymd(1969, 12, 31).and_hms(23, 59, 59))));
-
-    assert_eq!(*fixed_from_str("0").expect("0 timestamp should parse"),
-               Utc.ymd(1970, 1, 1).and_hms(0, 0, 0));
-    assert_eq!(*local_from_str("-1").expect("-1 timestamp should parse"),
-               Utc.ymd(1969, 12, 31).and_hms(23, 59, 59));
-}
-
 #[cfg(feature = "rustc-serialize")]
-pub mod rustc_serialize {
-    use std::fmt;
-    use std::ops::Deref;
+mod rustc_serialize {
     use super::DateTime;
-    #[cfg(feature="clock")]
-    use offset::Local;
-    use offset::{TimeZone, LocalResult, Utc, FixedOffset};
+    use offset::TimeZone;
     use rustc_serialize::{Encodable, Encoder, Decodable, Decoder};
 
-    impl<Tz: TimeZone> Encodable for DateTime<Tz> {
+    // TODO the current serialization format is NEVER intentionally defined.
+    // in the future it is likely to be redefined to more sane and reasonable format.
+
+    impl<Tz: TimeZone> Encodable for DateTime<Tz> where Tz::Offset: Encodable {
         fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
-            format!("{:?}", self).encode(s)
+            s.emit_struct("DateTime", 2, |s| {
+                try!(s.emit_struct_field("datetime", 0, |s| self.datetime.encode(s)));
+                try!(s.emit_struct_field("offset", 1, |s| self.offset.encode(s)));
+                Ok(())
+            })
         }
     }
 
-    // try!-like function to convert a LocalResult into a serde-ish Result
-    fn from<T, D>(me: LocalResult<T>, d: &mut D) -> Result<T, D::Error>
-        where D: Decoder,
-              T: fmt::Display,
-    {
-        match me {
-            LocalResult::None => Err(d.error(
-                "value is not a legal timestamp")),
-            LocalResult::Ambiguous(..) => Err(d.error(
-                "value is an ambiguous timestamp")),
-            LocalResult::Single(val) => Ok(val)
-        }
-    }
-
-    impl Decodable for DateTime<FixedOffset> {
-        fn decode<D: Decoder>(d: &mut D) -> Result<DateTime<FixedOffset>, D::Error> {
-            d.read_str()?.parse::<DateTime<FixedOffset>>()
-                    .map_err(|_| d.error("invalid date and time"))
-        }
-    }
-
-    #[allow(deprecated)]
-    impl Decodable for TsSeconds<FixedOffset> {
-        #[allow(deprecated)]
-        fn decode<D: Decoder>(d: &mut D) -> Result<TsSeconds<FixedOffset>, D::Error> {
-            from(FixedOffset::east(0).timestamp_opt(d.read_i64()?, 0), d)
-                .map(TsSeconds)
-        }
-    }
-
-    impl Decodable for DateTime<Utc> {
-        fn decode<D: Decoder>(d: &mut D) -> Result<DateTime<Utc>, D::Error> {
-            d.read_str()?
-                .parse::<DateTime<FixedOffset>>()
-                .map(|dt| dt.with_timezone(&Utc))
-                .map_err(|_| d.error("invalid date and time"))
-        }
-    }
-
-    /// A `DateTime` that can be deserialized from a timestamp
-    ///
-    /// A timestamp here is seconds since the epoch
-    #[derive(Debug)]
-    pub struct TsSeconds<Tz: TimeZone>(DateTime<Tz>);
-
-    #[allow(deprecated)]
-    impl<Tz: TimeZone> From<TsSeconds<Tz>> for DateTime<Tz> {
-        /// Pull the inner DateTime<Tz> out
-        #[allow(deprecated)]
-        fn from(obj: TsSeconds<Tz>) -> DateTime<Tz> {
-            obj.0
-        }
-    }
-
-    #[allow(deprecated)]
-    impl<Tz: TimeZone> Deref for TsSeconds<Tz> {
-        type Target = DateTime<Tz>;
-
-        fn deref(&self) -> &Self::Target {
-            &self.0
-        }
-    }
-
-    #[allow(deprecated)]
-    impl Decodable for TsSeconds<Utc> {
-        fn decode<D: Decoder>(d: &mut D) -> Result<TsSeconds<Utc>, D::Error> {
-            from(Utc.timestamp_opt(d.read_i64()?, 0), d)
-                .map(TsSeconds)
-        }
-    }
-
-    #[cfg(feature="clock")]
-    impl Decodable for DateTime<Local> {
-        fn decode<D: Decoder>(d: &mut D) -> Result<DateTime<Local>, D::Error> {
-            match d.read_str()?.parse::<DateTime<FixedOffset>>() {
-                Ok(dt) => Ok(dt.with_timezone(&Local)),
-                Err(_) => Err(d.error("invalid date and time")),
-            }
-        }
-    }
-
-    #[cfg(feature="clock")]
-    #[allow(deprecated)]
-    impl Decodable for TsSeconds<Local> {
-        #[allow(deprecated)]
-        fn decode<D: Decoder>(d: &mut D) -> Result<TsSeconds<Local>, D::Error> {
-            from(Utc.timestamp_opt(d.read_i64()?, 0), d)
-                .map(|dt| TsSeconds(dt.with_timezone(&Local)))
-        }
-    }
-
-    #[cfg(test)] use rustc_serialize::json;
-
-    #[test]
-    fn test_encodable() {
-        super::test_encodable_json(json::encode, json::encode);
-    }
-
-    #[cfg(feature="clock")]
-    #[test]
-    fn test_decodable() {
-        super::test_decodable_json(json::decode, json::decode, json::decode);
-    }
-
-    #[cfg(feature="clock")]
-    #[test]
-    fn test_decodable_timestamps() {
-        super::test_decodable_json_timestamps(json::decode, json::decode, json::decode);
-    }
-
-}
-
-/// documented at re-export site
-#[cfg(feature = "serde")]
-pub mod serde {
-    use std::fmt;
-    use super::DateTime;
-    #[cfg(feature="clock")]
-    use offset::Local;
-    use offset::{LocalResult, TimeZone, Utc, FixedOffset};
-    use serdelib::{ser, de};
-
-    // try!-like function to convert a LocalResult into a serde-ish Result
-    fn serde_from<T, E, V>(me: LocalResult<T>, ts: &V) -> Result<T, E>
-        where E: de::Error,
-                V: fmt::Display,
-                T: fmt::Display,
-    {
-        match me {
-            LocalResult::None => Err(E::custom(
-                format!("value is not a legal timestamp: {}", ts))),
-            LocalResult::Ambiguous(min, max) => Err(E::custom(
-                format!("value is an ambiguous timestamp: {}, could be either of {}, {}",
-                        ts, min, max))),
-            LocalResult::Single(val) => Ok(val)
+    impl<Tz: TimeZone> Decodable for DateTime<Tz> where Tz::Offset: Decodable {
+        fn decode<D: Decoder>(d: &mut D) -> Result<DateTime<Tz>, D::Error> {
+            d.read_struct("DateTime", 2, |d| {
+                let datetime = try!(d.read_struct_field("datetime", 0, Decodable::decode));
+                let offset = try!(d.read_struct_field("offset", 1, Decodable::decode));
+                Ok(DateTime::from_utc(datetime, offset))
+            })
         }
     }
 
-    /// Ser/de to/from timestamps in nanoseconds
-    ///
-    /// Intended for use with `serde`'s `with` attribute.
-    ///
-    /// # Example:
-    ///
-    /// ```rust
-    /// # // We mark this ignored so that we can test on 1.13 (which does not
-    /// # // support custom derive), and run tests with --ignored on beta and
-    /// # // nightly to actually trigger these.
-    /// #
-    /// # #[macro_use] extern crate serde_derive;
-    /// # #[macro_use] extern crate serde_json;
-    /// # extern crate chrono;
-    /// # use chrono::{TimeZone, DateTime, Utc};
-    /// use chrono::serde::ts_nanoseconds;
-    /// #[derive(Deserialize, Serialize)]
-    /// struct S {
-    ///     #[serde(with = "ts_nanoseconds")]
-    ///     time: DateTime<Utc>
-    /// }
-    ///
-    /// # fn example() -> Result<S, serde_json::Error> {
-    /// let time = Utc.ymd(2018, 5, 17).and_hms_nano(02, 04, 59, 918355733);
-    /// let my_s = S {
-    ///     time: time.clone(),
-    /// };
-    ///
-    /// let as_string = serde_json::to_string(&my_s)?;
-    /// assert_eq!(as_string, r#"{"time":1526522699918355733}"#);
-    /// let my_s: S = serde_json::from_str(&as_string)?;
-    /// assert_eq!(my_s.time, time);
-    /// # Ok(my_s)
-    /// # }
-    /// # fn main() { example().unwrap(); }
-    /// ```
-    pub mod ts_nanoseconds {
-        use std::fmt;
-        use serdelib::{ser, de};
-
-        use {DateTime, Utc};
-        use offset::TimeZone;
-
-        use super::serde_from;
+    #[test]
+    fn test_encodable() {
+        use offset::utc::UTC;
+        use rustc_serialize::json::encode;
 
-        /// Serialize a UTC datetime into an integer number of nanoseconds since the epoch
-        ///
-        /// Intended for use with `serde`s `serialize_with` attribute.
-        ///
-        /// # Example:
-        ///
-        /// ```rust
-        /// # // We mark this ignored so that we can test on 1.13 (which does not
-        /// # // support custom derive), and run tests with --ignored on beta and
-        /// # // nightly to actually trigger these.
-        /// #
-        /// # #[macro_use] extern crate serde_derive;
-        /// # #[macro_use] extern crate serde_json;
-        /// # extern crate chrono;
-        /// # use chrono::{TimeZone, DateTime, Utc};
-        /// use chrono::serde::ts_nanoseconds::serialize as to_nano_ts;
-        /// #[derive(Serialize)]
-        /// struct S {
-        ///     #[serde(serialize_with = "to_nano_ts")]
-        ///     time: DateTime<Utc>
-        /// }
-        ///
-        /// # fn example() -> Result<String, serde_json::Error> {
-        /// let my_s = S {
-        ///     time: Utc.ymd(2018, 5, 17).and_hms_nano(02, 04, 59, 918355733),
-        /// };
-        /// let as_string = serde_json::to_string(&my_s)?;
-        /// assert_eq!(as_string, r#"{"time":1526522699918355733}"#);
-        /// # Ok(as_string)
-        /// # }
-        /// # fn main() { example().unwrap(); }
-        /// ```
-        pub fn serialize<S>(dt: &DateTime<Utc>, serializer: S) -> Result<S::Ok, S::Error>
-            where S: ser::Serializer
-        {
-            serializer.serialize_i64(dt.timestamp_nanos())
-        }
-
-        /// Deserialize a `DateTime` from a nanosecond timestamp
-        ///
-        /// Intended for use with `serde`s `deserialize_with` attribute.
-        ///
-        /// # Example:
-        ///
-        /// ```rust
-        /// # // We mark this ignored so that we can test on 1.13 (which does not
-        /// # // support custom derive), and run tests with --ignored on beta and
-        /// # // nightly to actually trigger these.
-        /// #
-        /// # #[macro_use] extern crate serde_derive;
-        /// # #[macro_use] extern crate serde_json;
-        /// # extern crate chrono;
-        /// # use chrono::{DateTime, Utc};
-        /// use chrono::serde::ts_nanoseconds::deserialize as from_nano_ts;
-        /// #[derive(Deserialize)]
-        /// struct S {
-        ///     #[serde(deserialize_with = "from_nano_ts")]
-        ///     time: DateTime<Utc>
-        /// }
-        ///
-        /// # fn example() -> Result<S, serde_json::Error> {
-        /// let my_s: S = serde_json::from_str(r#"{ "time": 1526522699918355733 }"#)?;
-        /// # Ok(my_s)
-        /// # }
-        /// # fn main() { example().unwrap(); }
-        /// ```
-        pub fn deserialize<'de, D>(d: D) -> Result<DateTime<Utc>, D::Error>
-            where D: de::Deserializer<'de>
-        {
-            Ok(try!(d.deserialize_i64(NanoSecondsTimestampVisitor)))
-        }
-
-        struct NanoSecondsTimestampVisitor;
-
-        impl<'de> de::Visitor<'de> for NanoSecondsTimestampVisitor {
-            type Value = DateTime<Utc>;
-
-            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result
-            {
-                write!(formatter, "a unix timestamp in seconds")
-            }
-
-            /// Deserialize a timestamp in nanoseconds since the epoch
-            fn visit_i64<E>(self, value: i64) -> Result<DateTime<Utc>, E>
-                where E: de::Error
-            {
-                serde_from(Utc.timestamp_opt(value / 1_000_000_000,
-                                            (value % 1_000_000_000) as u32),
-                     &value)
-            }
-
-            /// Deserialize a timestamp in nanoseconds since the epoch
-            fn visit_u64<E>(self, value: u64) -> Result<DateTime<Utc>, E>
-                where E: de::Error
-            {
-                serde_from(Utc.timestamp_opt((value / 1_000_000_000) as i64,
-                                             (value % 1_000_000_000) as u32),
-                     &value)
-            }
-        }
+        assert_eq!(
+            encode(&UTC.ymd(2014, 7, 24).and_hms(12, 34, 6)).ok(),
+            Some(concat!(r#"{"datetime":{"date":{"ymdf":16501977},"#,
+                                      r#""time":{"secs":45246,"frac":0}},"#,
+                          r#""offset":{}}"#).into()));
     }
 
-    /// Ser/de to/from timestamps in milliseconds
-    ///
-    /// Intended for use with `serde`s `with` attribute.
-    ///
-    /// # Example
-    ///
-    /// ```rust
-    /// # // We mark this ignored so that we can test on 1.13 (which does not
-    /// # // support custom derive), and run tests with --ignored on beta and
-    /// # // nightly to actually trigger these.
-    /// #
-    /// # #[macro_use] extern crate serde_derive;
-    /// # #[macro_use] extern crate serde_json;
-    /// # extern crate chrono;
-    /// # use chrono::{TimeZone, DateTime, Utc};
-    /// use chrono::serde::ts_milliseconds;
-    /// #[derive(Deserialize, Serialize)]
-    /// struct S {
-    ///     #[serde(with = "ts_milliseconds")]
-    ///     time: DateTime<Utc>
-    /// }
-    ///
-    /// # fn example() -> Result<S, serde_json::Error> {
-    /// let time = Utc.ymd(2018, 5, 17).and_hms_milli(02, 04, 59, 918);
-    /// let my_s = S {
-    ///     time: time.clone(),
-    /// };
-    ///
-    /// let as_string = serde_json::to_string(&my_s)?;
-    /// assert_eq!(as_string, r#"{"time":1526522699918}"#);
-    /// let my_s: S = serde_json::from_str(&as_string)?;
-    /// assert_eq!(my_s.time, time);
-    /// # Ok(my_s)
-    /// # }
-    /// # fn main() { example().unwrap(); }
-    /// ```
-    pub mod ts_milliseconds {
-        use std::fmt;
-        use serdelib::{ser, de};
+    #[test]
+    fn test_decodable() {
+        use offset::utc::UTC;
+        use rustc_serialize::json;
+
+        let decode = |s: &str| json::decode::<DateTime<UTC>>(s);
+
+        assert_eq!(
+            decode(r#"{"datetime":{"date":{"ymdf":16501977},
+                                   "time":{"secs":45246,"frac":0}},
+                       "offset":{}}"#).ok(),
+            Some(UTC.ymd(2014, 7, 24).and_hms(12, 34, 6)));
 
-        use {DateTime, Utc};
-        use offset::TimeZone;
-
-        use super::serde_from;
+        assert_eq!(
+            decode(r#"{"datetime":{"date":{"ymdf":0},
+                                   "time":{"secs":0,"frac":0}},
+                       "offset":{}}"#).ok(),
+            None);
+    }
+}
 
-        /// Serialize a UTC datetime into an integer number of milliseconds since the epoch
-        ///
-        /// Intended for use with `serde`s `serialize_with` attribute.
-        ///
-        /// # Example:
-        ///
-        /// ```rust
-        /// # // We mark this ignored so that we can test on 1.13 (which does not
-        /// # // support custom derive), and run tests with --ignored on beta and
-        /// # // nightly to actually trigger these.
-        /// #
-        /// # #[macro_use] extern crate serde_derive;
-        /// # #[macro_use] extern crate serde_json;
-        /// # extern crate chrono;
-        /// # use chrono::{TimeZone, DateTime, Utc};
-        /// use chrono::serde::ts_milliseconds::serialize as to_milli_ts;
-        /// #[derive(Serialize)]
-        /// struct S {
-        ///     #[serde(serialize_with = "to_milli_ts")]
-        ///     time: DateTime<Utc>
-        /// }
-        ///
-        /// # fn example() -> Result<String, serde_json::Error> {
-        /// let my_s = S {
-        ///     time: Utc.ymd(2018, 5, 17).and_hms_milli(02, 04, 59, 918),
-        /// };
-        /// let as_string = serde_json::to_string(&my_s)?;
-        /// assert_eq!(as_string, r#"{"time":1526522699918}"#);
-        /// # Ok(as_string)
-        /// # }
-        /// # fn main() { example().unwrap(); }
-        /// ```
-        pub fn serialize<S>(dt: &DateTime<Utc>, serializer: S) -> Result<S::Ok, S::Error>
+#[cfg(feature = "serde")]
+mod serde {
+    use super::DateTime;
+    use offset::TimeZone;
+    use offset::utc::UTC;
+    use offset::local::Local;
+    use offset::fixed::FixedOffset;
+    use std::fmt::Display;
+    use serde::{ser, de};
+
+    // TODO not very optimized for space (binary formats would want something better)
+
+    impl<Tz: TimeZone> ser::Serialize for DateTime<Tz>
+        where Tz::Offset: Display
+    {
+        fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error>
             where S: ser::Serializer
         {
-            serializer.serialize_i64(dt.timestamp_millis())
-        }
-
-        /// Deserialize a `DateTime` from a millisecond timestamp
-        ///
-        /// Intended for use with `serde`s `deserialize_with` attribute.
-        ///
-        /// # Example:
-        ///
-        /// ```rust
-        /// # // We mark this ignored so that we can test on 1.13 (which does not
-        /// # // support custom derive), and run tests with --ignored on beta and
-        /// # // nightly to actually trigger these.
-        /// #
-        /// # #[macro_use] extern crate serde_derive;
-        /// # #[macro_use] extern crate serde_json;
-        /// # extern crate chrono;
-        /// # use chrono::{DateTime, Utc};
-        /// use chrono::serde::ts_milliseconds::deserialize as from_milli_ts;
-        /// #[derive(Deserialize)]
-        /// struct S {
-        ///     #[serde(deserialize_with = "from_milli_ts")]
-        ///     time: DateTime<Utc>
-        /// }
-        ///
-        /// # fn example() -> Result<S, serde_json::Error> {
-        /// let my_s: S = serde_json::from_str(r#"{ "time": 1526522699918 }"#)?;
-        /// # Ok(my_s)
-        /// # }
-        /// # fn main() { example().unwrap(); }
-        /// ```
-        pub fn deserialize<'de, D>(d: D) -> Result<DateTime<Utc>, D::Error>
-            where D: de::Deserializer<'de>
-        {
-            Ok(try!(d.deserialize_i64(MilliSecondsTimestampVisitor).map(|dt| dt.with_timezone(&Utc))))
-        }
-
-        struct MilliSecondsTimestampVisitor;
-
-        impl<'de> de::Visitor<'de> for MilliSecondsTimestampVisitor {
-            type Value = DateTime<Utc>;
-
-            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result
-            {
-                formatter.write_str("a unix timestamp in milliseconds")
-            }
-
-            /// Deserialize a timestamp in milliseconds since the epoch
-            fn visit_i64<E>(self, value: i64) -> Result<DateTime<Utc>, E>
-                where E: de::Error
-            {
-                serde_from(Utc.timestamp_opt(value / 1000,
-                                           ((value % 1000) * 1_000_000) as u32),
-                    &value)
-            }
-
-            /// Deserialize a timestamp in milliseconds since the epoch
-            fn visit_u64<E>(self, value: u64) -> Result<DateTime<Utc>, E>
-                where E: de::Error
-            {
-                serde_from(Utc.timestamp_opt((value / 1000) as i64,
-                                            ((value % 1000) * 1_000_000) as u32),
-                    &value)
-            }
-        }
-    }
-
-    /// Ser/de to/from timestamps in seconds
-    ///
-    /// Intended for use with `serde`'s `with` attribute.
-    ///
-    /// # Example:
-    ///
-    /// ```rust
-    /// # // We mark this ignored so that we can test on 1.13 (which does not
-    /// # // support custom derive), and run tests with --ignored on beta and
-    /// # // nightly to actually trigger these.
-    /// #
-    /// # #[macro_use] extern crate serde_derive;
-    /// # #[macro_use] extern crate serde_json;
-    /// # extern crate chrono;
-    /// # use chrono::{TimeZone, DateTime, Utc};
-    /// use chrono::serde::ts_seconds;
-    /// #[derive(Deserialize, Serialize)]
-    /// struct S {
-    ///     #[serde(with = "ts_seconds")]
-    ///     time: DateTime<Utc>
-    /// }
-    ///
-    /// # fn example() -> Result<S, serde_json::Error> {
-    /// let time = Utc.ymd(2015, 5, 15).and_hms(10, 0, 0);
-    /// let my_s = S {
-    ///     time: time.clone(),
-    /// };
-    ///
-    /// let as_string = serde_json::to_string(&my_s)?;
-    /// assert_eq!(as_string, r#"{"time":1431684000}"#);
-    /// let my_s: S = serde_json::from_str(&as_string)?;
-    /// assert_eq!(my_s.time, time);
-    /// # Ok(my_s)
-    /// # }
-    /// # fn main() { example().unwrap(); }
-    /// ```
-    pub mod ts_seconds {
-        use std::fmt;
-        use serdelib::{ser, de};
-
-        use {DateTime, Utc};
-        use offset::TimeZone;
-
-        use super::serde_from;
-
-        /// Serialize a UTC datetime into an integer number of seconds since the epoch
-        ///
-        /// Intended for use with `serde`s `serialize_with` attribute.
-        ///
-        /// # Example:
-        ///
-        /// ```rust
-        /// # // We mark this ignored so that we can test on 1.13 (which does not
-        /// # // support custom derive), and run tests with --ignored on beta and
-        /// # // nightly to actually trigger these.
-        /// #
-        /// # #[macro_use] extern crate serde_derive;
-        /// # #[macro_use] extern crate serde_json;
-        /// # extern crate chrono;
-        /// # use chrono::{TimeZone, DateTime, Utc};
-        /// use chrono::serde::ts_seconds::serialize as to_ts;
-        /// #[derive(Serialize)]
-        /// struct S {
-        ///     #[serde(serialize_with = "to_ts")]
-        ///     time: DateTime<Utc>
-        /// }
-        ///
-        /// # fn example() -> Result<String, serde_json::Error> {
-        /// let my_s = S {
-        ///     time: Utc.ymd(2015, 5, 15).and_hms(10, 0, 0),
-        /// };
-        /// let as_string = serde_json::to_string(&my_s)?;
-        /// assert_eq!(as_string, r#"{"time":1431684000}"#);
-        /// # Ok(as_string)
-        /// # }
-        /// # fn main() { example().unwrap(); }
-        /// ```
-        pub fn serialize<S>(dt: &DateTime<Utc>, serializer: S) -> Result<S::Ok, S::Error>
-            where S: ser::Serializer
-        {
-            serializer.serialize_i64(dt.timestamp())
-        }
-
-        /// Deserialize a `DateTime` from a seconds timestamp
-        ///
-        /// Intended for use with `serde`s `deserialize_with` attribute.
-        ///
-        /// # Example:
-        ///
-        /// ```rust
-        /// # // We mark this ignored so that we can test on 1.13 (which does not
-        /// # // support custom derive), and run tests with --ignored on beta and
-        /// # // nightly to actually trigger these.
-        /// #
-        /// # #[macro_use] extern crate serde_derive;
-        /// # #[macro_use] extern crate serde_json;
-        /// # extern crate chrono;
-        /// # use chrono::{DateTime, Utc};
-        /// use chrono::serde::ts_seconds::deserialize as from_ts;
-        /// #[derive(Deserialize)]
-        /// struct S {
-        ///     #[serde(deserialize_with = "from_ts")]
-        ///     time: DateTime<Utc>
-        /// }
-        ///
-        /// # fn example() -> Result<S, serde_json::Error> {
-        /// let my_s: S = serde_json::from_str(r#"{ "time": 1431684000 }"#)?;
-        /// # Ok(my_s)
-        /// # }
-        /// # fn main() { example().unwrap(); }
-        /// ```
-        pub fn deserialize<'de, D>(d: D) -> Result<DateTime<Utc>, D::Error>
-            where D: de::Deserializer<'de>
-        {
-            Ok(try!(d.deserialize_i64(SecondsTimestampVisitor)))
-        }
-
-        struct SecondsTimestampVisitor;
-
-        impl<'de> de::Visitor<'de> for SecondsTimestampVisitor {
-            type Value = DateTime<Utc>;
-
-            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result
-            {
-                formatter.write_str("a unix timestamp in seconds")
-            }
-
-            /// Deserialize a timestamp in seconds since the epoch
-            fn visit_i64<E>(self, value: i64) -> Result<DateTime<Utc>, E>
-                where E: de::Error
-            {
-                serde_from(Utc.timestamp_opt(value, 0), &value)
-            }
-
-            /// Deserialize a timestamp in seconds since the epoch
-            fn visit_u64<E>(self, value: u64) -> Result<DateTime<Utc>, E>
-                where E: de::Error
-            {
-                serde_from(Utc.timestamp_opt(value as i64, 0), &value)
-            }
-        }
-    }
-
-    impl<Tz: TimeZone> ser::Serialize for DateTime<Tz> {
-        /// Serialize into a rfc3339 time string
-        ///
-        /// See [the `serde` module](./serde/index.html) for alternate
-        /// serializations.
-        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
-            where S: ser::Serializer
-        {
-            struct FormatWrapped<'a, D: 'a> {
-                inner: &'a D
-            }
-
-            impl<'a, D: fmt::Debug> fmt::Display for FormatWrapped<'a, D> {
-                fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-                    self.inner.fmt(f)
-                }
-            }
-
             // Debug formatting is correct RFC3339, and it allows Zulu.
-            serializer.collect_str(&FormatWrapped { inner: &self })
+            serializer.serialize_str(&format!("{:?}", self))
         }
     }
 
     struct DateTimeVisitor;
 
-    impl<'de> de::Visitor<'de> for DateTimeVisitor {
+    impl de::Visitor for DateTimeVisitor {
         type Value = DateTime<FixedOffset>;
 
-        fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result
-        {
-            write!(formatter, "a formatted date and time string or a unix timestamp")
-        }
-
-        fn visit_str<E>(self, value: &str) -> Result<DateTime<FixedOffset>, E>
+        fn visit_str<E>(&mut self, value: &str) -> Result<DateTime<FixedOffset>, E>
             where E: de::Error
         {
             value.parse().map_err(|err| E::custom(format!("{}", err)))
         }
     }
 
-    /// Deserialize a value that optionally includes a timezone offset in its
-    /// string representation
-    ///
-    /// The value to be deserialized must be an rfc3339 string.
-    ///
-    /// See [the `serde` module](./serde/index.html) for alternate
-    /// deserialization formats.
-    impl<'de> de::Deserialize<'de> for DateTime<FixedOffset> {
-        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
-            where D: de::Deserializer<'de>
+    impl de::Deserialize for DateTime<FixedOffset> {
+        fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>
+            where D: de::Deserializer
         {
-            deserializer.deserialize_str(DateTimeVisitor)
+            deserializer.deserialize(DateTimeVisitor)
         }
     }
 
-    /// Deserialize into a UTC value
-    ///
-    /// The value to be deserialized must be an rfc3339 string.
-    ///
-    /// See [the `serde` module](./serde/index.html) for alternate
-    /// deserialization formats.
-    impl<'de> de::Deserialize<'de> for DateTime<Utc> {
-        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
-            where D: de::Deserializer<'de>
+    impl de::Deserialize for DateTime<UTC> {
+        fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>
+            where D: de::Deserializer
         {
-            deserializer.deserialize_str(DateTimeVisitor).map(|dt| dt.with_timezone(&Utc))
+            deserializer.deserialize(DateTimeVisitor).map(|dt| dt.with_timezone(&UTC))
         }
     }
 
-    /// Deserialize a value that includes no timezone in its string
-    /// representation
-    ///
-    /// The value to be deserialized must be an rfc3339 string.
-    ///
-    /// See [the `serde` module](./serde/index.html) for alternate
-    /// serialization formats.
-    #[cfg(feature="clock")]
-    impl<'de> de::Deserialize<'de> for DateTime<Local> {
-        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
-            where D: de::Deserializer<'de>
+    impl de::Deserialize for DateTime<Local> {
+        fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>
+            where D: de::Deserializer
         {
-            deserializer.deserialize_str(DateTimeVisitor).map(|dt| dt.with_timezone(&Local))
+            deserializer.deserialize(DateTimeVisitor).map(|dt| dt.with_timezone(&Local))
         }
     }
 
     #[cfg(test)] extern crate serde_json;
-    #[cfg(test)] extern crate bincode;
 
     #[test]
     fn test_serde_serialize() {
-        super::test_encodable_json(self::serde_json::to_string, self::serde_json::to_string);
-    }
+        use self::serde_json::to_string;
 
-    #[cfg(feature="clock")]
-    #[test]
-    fn test_serde_deserialize() {
-        super::test_decodable_json(|input| self::serde_json::from_str(&input), |input| self::serde_json::from_str(&input),
-                                   |input| self::serde_json::from_str(&input));
+        assert_eq!(to_string(&UTC.ymd(2014, 7, 24).and_hms(12, 34, 6)).ok(),
+                   Some(r#""2014-07-24T12:34:06Z""#.into()));
     }
 
     #[test]
-    fn test_serde_bincode() {
-        // Bincode is relevant to test separately from JSON because
-        // it is not self-describing.
-        use self::bincode::{Infinite, serialize, deserialize};
+    fn test_serde_deserialize() {
+        use self::serde_json;
+
+        let from_str = |s: &str| serde_json::from_str::<DateTime<UTC>>(s);
 
-        let dt = Utc.ymd(2014, 7, 24).and_hms(12, 34, 6);
-        let encoded = serialize(&dt, Infinite).unwrap();
-        let decoded: DateTime<Utc> = deserialize(&encoded).unwrap();
-        assert_eq!(dt, decoded);
-        assert_eq!(dt.offset(), decoded.offset());
+        assert_eq!(from_str(r#""2014-07-24T12:34:06Z""#).ok(),
+                   Some(UTC.ymd(2014, 7, 24).and_hms(12, 34, 6)));
+
+        assert!(from_str(r#""2014-07-32T12:34:06Z""#).is_err());
     }
 }
 
 #[cfg(test)]
 mod tests {
     use super::DateTime;
-    #[cfg(feature="clock")]
     use Datelike;
-    use naive::{NaiveTime, NaiveDate};
-    #[cfg(feature="clock")]
-    use offset::Local;
-    use offset::{TimeZone, Utc, FixedOffset};
-    use oldtime::Duration;
-    use std::time::{SystemTime, UNIX_EPOCH};
+    use naive::time::NaiveTime;
+    use naive::date::NaiveDate;
+    use duration::Duration;
+    use offset::TimeZone;
+    use offset::utc::UTC;
+    use offset::local::Local;
+    use offset::fixed::FixedOffset;
 
     #[test]
     #[allow(non_snake_case)]
     fn test_datetime_offset() {
-        let Est = FixedOffset::west(5*60*60);
-        let Edt = FixedOffset::west(4*60*60);
-        let Kst = FixedOffset::east(9*60*60);
+        let EST = FixedOffset::west(5*60*60);
+        let EDT = FixedOffset::west(4*60*60);
+        let KST = FixedOffset::east(9*60*60);
 
-        assert_eq!(format!("{}", Utc.ymd(2014, 5, 6).and_hms(7, 8, 9)),
+        assert_eq!(format!("{}", UTC.ymd(2014, 5, 6).and_hms(7, 8, 9)),
                    "2014-05-06 07:08:09 UTC");
-        assert_eq!(format!("{}", Edt.ymd(2014, 5, 6).and_hms(7, 8, 9)),
+        assert_eq!(format!("{}", EDT.ymd(2014, 5, 6).and_hms(7, 8, 9)),
                    "2014-05-06 07:08:09 -04:00");
-        assert_eq!(format!("{}", Kst.ymd(2014, 5, 6).and_hms(7, 8, 9)),
+        assert_eq!(format!("{}", KST.ymd(2014, 5, 6).and_hms(7, 8, 9)),
                    "2014-05-06 07:08:09 +09:00");
-        assert_eq!(format!("{:?}", Utc.ymd(2014, 5, 6).and_hms(7, 8, 9)),
+        assert_eq!(format!("{:?}", UTC.ymd(2014, 5, 6).and_hms(7, 8, 9)),
                    "2014-05-06T07:08:09Z");
-        assert_eq!(format!("{:?}", Edt.ymd(2014, 5, 6).and_hms(7, 8, 9)),
+        assert_eq!(format!("{:?}", EDT.ymd(2014, 5, 6).and_hms(7, 8, 9)),
                    "2014-05-06T07:08:09-04:00");
-        assert_eq!(format!("{:?}", Kst.ymd(2014, 5, 6).and_hms(7, 8, 9)),
+        assert_eq!(format!("{:?}", KST.ymd(2014, 5, 6).and_hms(7, 8, 9)),
                    "2014-05-06T07:08:09+09:00");
 
         // edge cases
-        assert_eq!(format!("{:?}", Utc.ymd(2014, 5, 6).and_hms(0, 0, 0)),
+        assert_eq!(format!("{:?}", UTC.ymd(2014, 5, 6).and_hms(0, 0, 0)),
                    "2014-05-06T00:00:00Z");
-        assert_eq!(format!("{:?}", Edt.ymd(2014, 5, 6).and_hms(0, 0, 0)),
+        assert_eq!(format!("{:?}", EDT.ymd(2014, 5, 6).and_hms(0, 0, 0)),
                    "2014-05-06T00:00:00-04:00");
-        assert_eq!(format!("{:?}", Kst.ymd(2014, 5, 6).and_hms(0, 0, 0)),
+        assert_eq!(format!("{:?}", KST.ymd(2014, 5, 6).and_hms(0, 0, 0)),
                    "2014-05-06T00:00:00+09:00");
-        assert_eq!(format!("{:?}", Utc.ymd(2014, 5, 6).and_hms(23, 59, 59)),
+        assert_eq!(format!("{:?}", UTC.ymd(2014, 5, 6).and_hms(23, 59, 59)),
                    "2014-05-06T23:59:59Z");
-        assert_eq!(format!("{:?}", Edt.ymd(2014, 5, 6).and_hms(23, 59, 59)),
+        assert_eq!(format!("{:?}", EDT.ymd(2014, 5, 6).and_hms(23, 59, 59)),
                    "2014-05-06T23:59:59-04:00");
-        assert_eq!(format!("{:?}", Kst.ymd(2014, 5, 6).and_hms(23, 59, 59)),
+        assert_eq!(format!("{:?}", KST.ymd(2014, 5, 6).and_hms(23, 59, 59)),
                    "2014-05-06T23:59:59+09:00");
 
-        let dt = Utc.ymd(2014, 5, 6).and_hms(7, 8, 9);
-        assert_eq!(dt, Edt.ymd(2014, 5, 6).and_hms(3, 8, 9));
-        assert_eq!(dt + Duration::seconds(3600 + 60 + 1), Utc.ymd(2014, 5, 6).and_hms(8, 9, 10));
-        assert_eq!(dt.signed_duration_since(Edt.ymd(2014, 5, 6).and_hms(10, 11, 12)),
+        assert_eq!(UTC.ymd(2014, 5, 6).and_hms(7, 8, 9), EDT.ymd(2014, 5, 6).and_hms(3, 8, 9));
+        assert_eq!(UTC.ymd(2014, 5, 6).and_hms(7, 8, 9) + Duration::seconds(3600 + 60 + 1),
+                   UTC.ymd(2014, 5, 6).and_hms(8, 9, 10));
+        assert_eq!(UTC.ymd(2014, 5, 6).and_hms(7, 8, 9) - EDT.ymd(2014, 5, 6).and_hms(10, 11, 12),
                    Duration::seconds(-7*3600 - 3*60 - 3));
 
-        assert_eq!(*Utc.ymd(2014, 5, 6).and_hms(7, 8, 9).offset(), Utc);
-        assert_eq!(*Edt.ymd(2014, 5, 6).and_hms(7, 8, 9).offset(), Edt);
-        assert!(*Edt.ymd(2014, 5, 6).and_hms(7, 8, 9).offset() != Est);
+        assert_eq!(*UTC.ymd(2014, 5, 6).and_hms(7, 8, 9).offset(), UTC);
+        assert_eq!(*EDT.ymd(2014, 5, 6).and_hms(7, 8, 9).offset(), EDT);
+        assert!(*EDT.ymd(2014, 5, 6).and_hms(7, 8, 9).offset() != EST);
     }
 
     #[test]
     fn test_datetime_date_and_time() {
         let tz = FixedOffset::east(5*60*60);
         let d = tz.ymd(2014, 5, 6).and_hms(7, 8, 9);
         assert_eq!(d.time(), NaiveTime::from_hms(7, 8, 9));
         assert_eq!(d.date(), tz.ymd(2014, 5, 6));
@@ -1479,31 +616,30 @@ mod tests {
         let d = tz.ymd(2017, 8, 9).and_hms(12, 34, 56);
         assert_eq!(d.time(), NaiveTime::from_hms(12, 34, 56));
         assert_eq!(d.date(), tz.ymd(2017, 8, 9));
         assert_eq!(d.date().naive_local(), NaiveDate::from_ymd(2017, 8, 9));
         assert_eq!(d.date().and_time(d.time()), Some(d));
     }
 
     #[test]
-    #[cfg(feature="clock")]
     fn test_datetime_with_timezone() {
         let local_now = Local::now();
-        let utc_now = local_now.with_timezone(&Utc);
+        let utc_now = local_now.with_timezone(&UTC);
         let local_now2 = utc_now.with_timezone(&Local);
         assert_eq!(local_now, local_now2);
     }
 
     #[test]
     #[allow(non_snake_case)]
     fn test_datetime_rfc2822_and_rfc3339() {
         let EDT = FixedOffset::east(5*60*60);
-        assert_eq!(Utc.ymd(2015, 2, 18).and_hms(23, 16, 9).to_rfc2822(),
+        assert_eq!(UTC.ymd(2015, 2, 18).and_hms(23, 16, 9).to_rfc2822(),
                    "Wed, 18 Feb 2015 23:16:09 +0000");
-        assert_eq!(Utc.ymd(2015, 2, 18).and_hms(23, 16, 9).to_rfc3339(),
+        assert_eq!(UTC.ymd(2015, 2, 18).and_hms(23, 16, 9).to_rfc3339(),
                    "2015-02-18T23:16:09+00:00");
         assert_eq!(EDT.ymd(2015, 2, 18).and_hms_milli(23, 16, 9, 150).to_rfc2822(),
                    "Wed, 18 Feb 2015 23:16:09 +0500");
         assert_eq!(EDT.ymd(2015, 2, 18).and_hms_milli(23, 16, 9, 150).to_rfc3339(),
                    "2015-02-18T23:16:09.150+05:00");
         assert_eq!(EDT.ymd(2015, 2, 18).and_hms_micro(23, 59, 59, 1_234_567).to_rfc2822(),
                    "Wed, 18 Feb 2015 23:59:60 +0500");
         assert_eq!(EDT.ymd(2015, 2, 18).and_hms_micro(23, 59, 59, 1_234_567).to_rfc3339(),
@@ -1515,133 +651,73 @@ mod tests {
                    Ok(FixedOffset::east(0).ymd(2015, 2, 18).and_hms(23, 16, 9)));
         assert_eq!(DateTime::parse_from_rfc2822("Wed, 18 Feb 2015 23:59:60 +0500"),
                    Ok(EDT.ymd(2015, 2, 18).and_hms_milli(23, 59, 59, 1_000)));
         assert_eq!(DateTime::parse_from_rfc3339("2015-02-18T23:59:60.234567+05:00"),
                    Ok(EDT.ymd(2015, 2, 18).and_hms_micro(23, 59, 59, 1_234_567)));
     }
 
     #[test]
-    fn test_rfc3339_opts() {
-        use SecondsFormat::*;
-        let pst = FixedOffset::east(8 * 60 * 60);
-        let dt = pst.ymd(2018, 1, 11).and_hms_nano(10, 5, 13, 084_660_000);
-        assert_eq!(dt.to_rfc3339_opts(Secs, false),   "2018-01-11T10:05:13+08:00");
-        assert_eq!(dt.to_rfc3339_opts(Secs, true),    "2018-01-11T10:05:13+08:00");
-        assert_eq!(dt.to_rfc3339_opts(Millis, false), "2018-01-11T10:05:13.084+08:00");
-        assert_eq!(dt.to_rfc3339_opts(Micros, false), "2018-01-11T10:05:13.084660+08:00");
-        assert_eq!(dt.to_rfc3339_opts(Nanos, false),  "2018-01-11T10:05:13.084660000+08:00");
-        assert_eq!(dt.to_rfc3339_opts(AutoSi, false), "2018-01-11T10:05:13.084660+08:00");
-
-        let ut = DateTime::<Utc>::from_utc(dt.naive_utc(), Utc);
-        assert_eq!(ut.to_rfc3339_opts(Secs, false),   "2018-01-11T02:05:13+00:00");
-        assert_eq!(ut.to_rfc3339_opts(Secs, true),    "2018-01-11T02:05:13Z");
-        assert_eq!(ut.to_rfc3339_opts(Millis, false), "2018-01-11T02:05:13.084+00:00");
-        assert_eq!(ut.to_rfc3339_opts(Millis, true),  "2018-01-11T02:05:13.084Z");
-        assert_eq!(ut.to_rfc3339_opts(Micros, true),  "2018-01-11T02:05:13.084660Z");
-        assert_eq!(ut.to_rfc3339_opts(Nanos, true),   "2018-01-11T02:05:13.084660000Z");
-        assert_eq!(ut.to_rfc3339_opts(AutoSi, true),  "2018-01-11T02:05:13.084660Z");
-    }
-
-    #[test]
-    #[should_panic]
-    fn test_rfc3339_opts_nonexhaustive() {
-        use SecondsFormat;
-        let dt = Utc.ymd(1999, 10, 9).and_hms(1, 2, 3);
-        dt.to_rfc3339_opts(SecondsFormat::__NonExhaustive, true);
-    }
-
-    #[test]
     fn test_datetime_from_str() {
         assert_eq!("2015-2-18T23:16:9.15Z".parse::<DateTime<FixedOffset>>(),
                    Ok(FixedOffset::east(0).ymd(2015, 2, 18).and_hms_milli(23, 16, 9, 150)));
         assert_eq!("2015-2-18T13:16:9.15-10:00".parse::<DateTime<FixedOffset>>(),
                    Ok(FixedOffset::west(10 * 3600).ymd(2015, 2, 18).and_hms_milli(13, 16, 9, 150)));
         assert!("2015-2-18T23:16:9.15".parse::<DateTime<FixedOffset>>().is_err());
 
-        assert_eq!("2015-2-18T23:16:9.15Z".parse::<DateTime<Utc>>(),
-                   Ok(Utc.ymd(2015, 2, 18).and_hms_milli(23, 16, 9, 150)));
-        assert_eq!("2015-2-18T13:16:9.15-10:00".parse::<DateTime<Utc>>(),
-                   Ok(Utc.ymd(2015, 2, 18).and_hms_milli(23, 16, 9, 150)));
-        assert!("2015-2-18T23:16:9.15".parse::<DateTime<Utc>>().is_err());
+        assert_eq!("2015-2-18T23:16:9.15Z".parse::<DateTime<UTC>>(),
+                   Ok(UTC.ymd(2015, 2, 18).and_hms_milli(23, 16, 9, 150)));
+        assert_eq!("2015-2-18T13:16:9.15-10:00".parse::<DateTime<UTC>>(),
+                   Ok(UTC.ymd(2015, 2, 18).and_hms_milli(23, 16, 9, 150)));
+        assert!("2015-2-18T23:16:9.15".parse::<DateTime<UTC>>().is_err());
 
         // no test for `DateTime<Local>`, we cannot verify that much.
     }
 
     #[test]
     fn test_datetime_parse_from_str() {
         let ymdhms = |y,m,d,h,n,s,off| FixedOffset::east(off).ymd(y,m,d).and_hms(h,n,s);
         assert_eq!(DateTime::parse_from_str("2014-5-7T12:34:56+09:30", "%Y-%m-%dT%H:%M:%S%z"),
                    Ok(ymdhms(2014, 5, 7, 12, 34, 56, 570*60))); // ignore offset
         assert!(DateTime::parse_from_str("20140507000000", "%Y%m%d%H%M%S").is_err()); // no offset
         assert!(DateTime::parse_from_str("Fri, 09 Aug 2013 23:54:35 GMT",
                                          "%a, %d %b %Y %H:%M:%S GMT").is_err());
-        assert_eq!(Utc.datetime_from_str("Fri, 09 Aug 2013 23:54:35 GMT",
+        assert_eq!(UTC.datetime_from_str("Fri, 09 Aug 2013 23:54:35 GMT",
                                          "%a, %d %b %Y %H:%M:%S GMT"),
-                   Ok(Utc.ymd(2013, 8, 9).and_hms(23, 54, 35)));
+                   Ok(UTC.ymd(2013, 8, 9).and_hms(23, 54, 35)));
     }
 
     #[test]
-    #[cfg(feature="clock")]
     fn test_datetime_format_with_local() {
         // if we are not around the year boundary, local and UTC date should have the same year
         let dt = Local::now().with_month(5).unwrap();
-        assert_eq!(dt.format("%Y").to_string(), dt.with_timezone(&Utc).format("%Y").to_string());
+        assert_eq!(dt.format("%Y").to_string(), dt.with_timezone(&UTC).format("%Y").to_string());
     }
 
     #[test]
-    #[cfg(feature="clock")]
     fn test_datetime_is_copy() {
         // UTC is known to be `Copy`.
-        let a = Utc::now();
+        let a = UTC::now();
         let b = a;
         assert_eq!(a, b);
     }
 
     #[test]
-    #[cfg(feature="clock")]
     fn test_datetime_is_send() {
         use std::thread;
 
         // UTC is known to be `Send`.
-        let a = Utc::now();
+        let a = UTC::now();
         thread::spawn(move || {
             let _ = a;
         }).join().unwrap();
     }
 
     #[test]
     fn test_subsecond_part() {
-        let datetime = Utc.ymd(2014, 7, 8).and_hms_nano(9, 10, 11, 1234567);
+        let datetime = UTC.ymd(2014, 7, 8).and_hms_nano(9, 10, 11, 1234567);
 
         assert_eq!(1,       datetime.timestamp_subsec_millis());
         assert_eq!(1234,    datetime.timestamp_subsec_micros());
         assert_eq!(1234567, datetime.timestamp_subsec_nanos());
     }
-
-    #[test]
-    fn test_from_system_time() {
-        use std::time::Duration;
-
-        let epoch = Utc.ymd(1970, 1, 1).and_hms(0, 0, 0);
-
-        // SystemTime -> DateTime<Utc>
-        assert_eq!(DateTime::<Utc>::from(UNIX_EPOCH), epoch);
-        assert_eq!(DateTime::<Utc>::from(UNIX_EPOCH + Duration::new(999_999_999, 999_999_999)),
-                   Utc.ymd(2001, 9, 9).and_hms_nano(1, 46, 39, 999_999_999));
-        assert_eq!(DateTime::<Utc>::from(UNIX_EPOCH - Duration::new(999_999_999, 999_999_999)),
-                   Utc.ymd(1938, 4, 24).and_hms_nano(22, 13, 20, 1));
+}
 
-        // DateTime<Utc> -> SystemTime
-        assert_eq!(SystemTime::from(epoch), UNIX_EPOCH);
-        assert_eq!(SystemTime::from(Utc.ymd(2001, 9, 9).and_hms_nano(1, 46, 39, 999_999_999)),
-                   UNIX_EPOCH + Duration::new(999_999_999, 999_999_999));
-        assert_eq!(SystemTime::from(Utc.ymd(1938, 4, 24).and_hms_nano(22, 13, 20, 1)),
-                   UNIX_EPOCH - Duration::new(999_999_999, 999_999_999));
-
-        // DateTime<any tz> -> SystemTime (via `with_timezone`)
-        #[cfg(feature="clock")] {
-            assert_eq!(SystemTime::from(epoch.with_timezone(&Local)), UNIX_EPOCH);
-        }
-        assert_eq!(SystemTime::from(epoch.with_timezone(&FixedOffset::east(32400))), UNIX_EPOCH);
-        assert_eq!(SystemTime::from(epoch.with_timezone(&FixedOffset::west(28800))), UNIX_EPOCH);
-    }
-}
--- a/third_party/rust/chrono/src/div.rs
+++ b/third_party/rust/chrono/src/div.rs
@@ -1,18 +1,19 @@
-// This is a part of Chrono.
-// Portions Copyright 2013-2014 The Rust Project Developers.
+// This is a part of rust-chrono.
+// Copyright (c) 2014, Kang Seonghoon.
+// Copyright 2013-2014 The Rust Project Developers.
 // See README.md and LICENSE.txt for details.
 
 //! Integer division utilities. (Shamelessly copied from [num](https://github.com/rust-lang/num/))
 
 // Algorithm from [Daan Leijen. _Division and Modulus for Computer Scientists_,
 // December 2001](http://research.microsoft.com/pubs/151917/divmodnote-letter.pdf)
 
-pub use num_integer::{div_rem, div_floor, mod_floor, div_mod_floor};
+pub use num::integer::{div_rem, div_floor, mod_floor, div_mod_floor};
 
 #[cfg(test)]
 mod tests {
     use super::{mod_floor, div_mod_floor};
 
     #[test]
     fn test_mod_floor() {
         assert_eq!(mod_floor( 8,  3),  2);
--- a/third_party/rust/chrono/src/format/mod.rs
+++ b/third_party/rust/chrono/src/format/mod.rs
@@ -1,42 +1,28 @@
-// This is a part of Chrono.
+// This is a part of rust-chrono.
+// Copyright (c) 2014-2015, Kang Seonghoon.
 // See README.md and LICENSE.txt for details.
 
-//! Formatting (and parsing) utilities for date and time.
-//!
-//! This module provides the common types and routines to implement,
-//! for example, [`DateTime::format`](../struct.DateTime.html#method.format) or
-//! [`DateTime::parse_from_str`](../struct.DateTime.html#method.parse_from_str) methods.
-//! For most cases you should use these high-level interfaces.
-//!
-//! Internally the formatting and parsing shares the same abstract **formatting items**,
-//! which are just an [`Iterator`](https://doc.rust-lang.org/std/iter/trait.Iterator.html) of
-//! the [`Item`](./enum.Item.html) type.
-//! They are generated from more readable **format strings**;
-//! currently Chrono supports [one built-in syntax closely resembling
-//! C's `strftime` format](./strftime/index.html).
+//! Formatting utilities for date and time.
 
 use std::fmt;
-use std::str::FromStr;
 use std::error::Error;
 
-use {Datelike, Timelike, Weekday, ParseWeekdayError};
+use {Datelike, Timelike};
 use div::{div_floor, mod_floor};
-use offset::{Offset, FixedOffset};
-use naive::{NaiveDate, NaiveTime};
+use duration::Duration;
+use offset::Offset;
+use naive::date::NaiveDate;
+use naive::time::NaiveTime;
 
 pub use self::strftime::StrftimeItems;
 pub use self::parsed::Parsed;
 pub use self::parse::parse;
 
-/// An unhabitated type used for `InternalNumeric` and `InternalFixed` below.
-#[derive(Clone, PartialEq, Eq)]
-enum Void {}
-
 /// Padding characters for numeric items.
 #[derive(Copy, Clone, PartialEq, Eq, Debug)]
 pub enum Pad {
     /// No padding.
     None,
     /// Zero (`0`) padding.
     Zero,
     /// Space padding.
@@ -47,21 +33,21 @@ pub enum Pad {
 /// They have associated formatting width (FW) and parsing width (PW).
 ///
 /// The **formatting width** is the minimal width to be formatted.
 /// If the number is too short, and the padding is not [`Pad::None`](./enum.Pad.html#variant.None),
 /// then it is left-padded.
 /// If the number is too long or (in some cases) negative, it is printed as is.
 ///
 /// The **parsing width** is the maximal width to be scanned.
-/// The parser only tries to consume from one to given number of digits (greedily).
+/// The parser only tries to consume from one to given number of digits (greedily). 
 /// It also trims the preceding whitespaces if any.
 /// It cannot parse the negative number, so some date and time cannot be formatted then
 /// parsed with the same formatting items.
-#[derive(Clone, PartialEq, Eq, Debug)]
+#[derive(Copy, Clone, PartialEq, Eq, Debug)]
 pub enum Numeric {
     /// Full Gregorian year (FW=4, PW=∞).
     /// May accept years before 1 BCE or after 9999 CE, given an initial sign.
     Year,
     /// Gregorian year divided by 100 (century number; FW=PW=2). Implies the non-negative year.
     YearDiv100,
     /// Gregorian year modulo 100 (FW=PW=2). Cannot be negative.
     YearMod100,
@@ -98,55 +84,23 @@ pub enum Numeric {
     Second,
     /// The number of nanoseconds since the last whole second (FW=PW=9).
     /// Note that this is *not* left-aligned;
     /// see also [`Fixed::Nanosecond`](./enum.Fixed.html#variant.Nanosecond).
     Nanosecond,
     /// The number of non-leap seconds since the midnight UTC on January 1, 1970 (FW=1, PW=∞).
     /// For formatting, it assumes UTC upon the absence of time zone offset.
     Timestamp,
-
-    /// Internal uses only.
-    ///
-    /// This item exists so that one can add additional internal-only formatting
-    /// without breaking major compatibility (as enum variants cannot be selectively private).
-    Internal(InternalNumeric),
-}
-
-/// An opaque type representing numeric item types for internal uses only.
-pub struct InternalNumeric {
-    _dummy: Void,
-}
-
-impl Clone for InternalNumeric {
-    fn clone(&self) -> Self {
-        match self._dummy {}
-    }
-}
-
-impl PartialEq for InternalNumeric {
-    fn eq(&self, _other: &InternalNumeric) -> bool {
-        match self._dummy {}
-    }
-}
-
-impl Eq for InternalNumeric {
-}
-
-impl fmt::Debug for InternalNumeric {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "<InternalNumeric>")
-    }
 }
 
 /// Fixed-format item types.
 ///
 /// They have their own rules of formatting and parsing.
 /// Otherwise noted, they print in the specified cases but parse case-insensitively.
-#[derive(Clone, PartialEq, Eq, Debug)]
+#[derive(Copy, Clone, PartialEq, Eq, Debug)]
 pub enum Fixed {
     /// Abbreviated month names.
     ///
     /// Prints a three-letter-long name in the title case, reads the same name in any case.
     ShortMonthName,
     /// Full month names.
     ///
     /// Prints a full name in the title case, reads either a short or full name in any case.
@@ -180,101 +134,65 @@ pub enum Fixed {
     /// Timezone name.
     ///
     /// It does not support parsing, its use in the parser is an immediate failure.
     TimezoneName,
     /// Offset from the local time to UTC (`+09:00` or `-04:00` or `+00:00`).
     ///
     /// In the parser, the colon can be omitted and/or surrounded with any amount of whitespaces.
     /// The offset is limited from `-24:00` to `+24:00`,
-    /// which is same to [`FixedOffset`](../offset/struct.FixedOffset.html)'s range.
+    /// which is same to [`FixedOffset`](../offset/fixed/struct.FixedOffset.html)'s range.
     TimezoneOffsetColon,
     /// Offset from the local time to UTC (`+09:00` or `-04:00` or `Z`).
     ///
     /// In the parser, the colon can be omitted and/or surrounded with any amount of whitespaces,
     /// and `Z` can be either in upper case or in lower case.
     /// The offset is limited from `-24:00` to `+24:00`,
-    /// which is same to [`FixedOffset`](../offset/struct.FixedOffset.html)'s range.
+    /// which is same to [`FixedOffset`](../offset/fixed/struct.FixedOffset.html)'s range.
     TimezoneOffsetColonZ,
     /// Same to [`TimezoneOffsetColon`](#variant.TimezoneOffsetColon) but prints no colon.
     /// Parsing allows an optional colon.
     TimezoneOffset,
     /// Same to [`TimezoneOffsetColonZ`](#variant.TimezoneOffsetColonZ) but prints no colon.
     /// Parsing allows an optional colon.
     TimezoneOffsetZ,
     /// RFC 2822 date and time syntax. Commonly used for email and MIME date and time.
     RFC2822,
     /// RFC 3339 & ISO 8601 date and time syntax.
     RFC3339,
-
-    /// Internal uses only.
-    ///
-    /// This item exists so that one can add additional internal-only formatting
-    /// without breaking major compatibility (as enum variants cannot be selectively private).
-    Internal(InternalFixed),
-}
-
-/// An opaque type representing fixed-format item types for internal uses only.
-#[derive(Debug, Clone, PartialEq, Eq)]
-pub struct InternalFixed {
-    val: InternalInternal,
-}
-
-#[derive(Debug, Clone, PartialEq, Eq)]
-enum InternalInternal {
-    /// Same as [`TimezoneOffsetColonZ`](#variant.TimezoneOffsetColonZ), but
-    /// allows missing minutes (per [ISO 8601][iso8601]).
-    ///
-    /// # Panics
-    ///
-    /// If you try to use this for printing.
-    ///
-    /// [iso8601]: https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC
-    TimezoneOffsetPermissive,
-    /// Same to [`Nanosecond`](#variant.Nanosecond) but the accuracy is fixed to 3 and there is no leading dot.
-    Nanosecond3NoDot,
-    /// Same to [`Nanosecond`](#variant.Nanosecond) but the accuracy is fixed to 6 and there is no leading dot.
-    Nanosecond6NoDot,
-    /// Same to [`Nanosecond`](#variant.Nanosecond) but the accuracy is fixed to 9 and there is no leading dot.
-    Nanosecond9NoDot,
 }
 
 /// A single formatting item. This is used for both formatting and parsing.
-#[derive(Clone, PartialEq, Eq, Debug)]
+#[derive(Copy, Clone, PartialEq, Eq, Debug)]
 pub enum Item<'a> {
     /// A literally printed and parsed text.
     Literal(&'a str),
-    /// Same to `Literal` but with the string owned by the item.
-    OwnedLiteral(Box<str>),
     /// Whitespace. Prints literally but reads zero or more whitespace.
     Space(&'a str),
-    /// Same to `Space` but with the string owned by the item.
-    OwnedSpace(Box<str>),
     /// Numeric item. Can be optionally padded to the maximal length (if any) when formatting;
     /// the parser simply ignores any padded whitespace and zeroes.
     Numeric(Numeric, Pad),
     /// Fixed-format item.
     Fixed(Fixed),
     /// Issues a formatting error. Used to signal an invalid format string.
     Error,
 }
 
 macro_rules! lit  { ($x:expr) => (Item::Literal($x)) }
 macro_rules! sp   { ($x:expr) => (Item::Space($x)) }
 macro_rules! num  { ($x:ident) => (Item::Numeric(Numeric::$x, Pad::None)) }
 macro_rules! num0 { ($x:ident) => (Item::Numeric(Numeric::$x, Pad::Zero)) }
 macro_rules! nums { ($x:ident) => (Item::Numeric(Numeric::$x, Pad::Space)) }
 macro_rules! fix  { ($x:ident) => (Item::Fixed(Fixed::$x)) }
-macro_rules! internal_fix { ($x:ident) => (Item::Fixed(Fixed::Internal(InternalFixed { val: InternalInternal::$x })))}
 
 /// An error from the `parse` function.
-#[derive(Debug, Clone, PartialEq, Eq, Copy)]
+#[derive(Debug, Clone, PartialEq, Copy)]
 pub struct ParseError(ParseErrorKind);
 
-#[derive(Debug, Clone, PartialEq, Eq, Copy)]
+#[derive(Debug, Clone, PartialEq, Copy)]
 enum ParseErrorKind {
     /// Given field is out of permitted range.
     OutOfRange,
 
     /// There is no possible date and time value with given set of fields.
     ///
     /// This does not include the out-of-range conditions, which are trivially invalid.
     /// It includes the case that there are one or more fields that are inconsistent to each other.
@@ -330,81 +248,73 @@ const NOT_ENOUGH:   ParseError = ParseEr
 const INVALID:      ParseError = ParseError(ParseErrorKind::Invalid);
 const TOO_SHORT:    ParseError = ParseError(ParseErrorKind::TooShort);
 const TOO_LONG:     ParseError = ParseError(ParseErrorKind::TooLong);
 const BAD_FORMAT:   ParseError = ParseError(ParseErrorKind::BadFormat);
 
 /// Tries to format given arguments with given formatting items.
 /// Internally used by `DelayedFormat`.
 pub fn format<'a, I>(w: &mut fmt::Formatter, date: Option<&NaiveDate>, time: Option<&NaiveTime>,
-                     off: Option<&(String, FixedOffset)>, items: I) -> fmt::Result
+                     off: Option<&(String, Duration)>, items: I) -> fmt::Result
         where I: Iterator<Item=Item<'a>> {
     // full and abbreviated month and weekday names
     static SHORT_MONTHS: [&'static str; 12] =
         ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
     static LONG_MONTHS: [&'static str; 12] =
         ["January", "February", "March", "April", "May", "June",
          "July", "August", "September", "October", "November", "December"];
     static SHORT_WEEKDAYS: [&'static str; 7] =
         ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
     static LONG_WEEKDAYS: [&'static str; 7] =
         ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
 
     for item in items {
         match item {
             Item::Literal(s) | Item::Space(s) => try!(write!(w, "{}", s)),
-            Item::OwnedLiteral(ref s) | Item::OwnedSpace(ref s) => try!(write!(w, "{}", s)),
 
             Item::Numeric(spec, pad) => {
                 use self::Numeric::*;
 
                 let week_from_sun = |d: &NaiveDate|
                     (d.ordinal() as i32 - d.weekday().num_days_from_sunday() as i32 + 7) / 7;
                 let week_from_mon = |d: &NaiveDate|
                     (d.ordinal() as i32 - d.weekday().num_days_from_monday() as i32 + 7) / 7;
 
                 let (width, v) = match spec {
-                    Year           => (4, date.map(|d| i64::from(d.year()))),
-                    YearDiv100     => (2, date.map(|d| div_floor(i64::from(d.year()), 100))),
-                    YearMod100     => (2, date.map(|d| mod_floor(i64::from(d.year()), 100))),
-                    IsoYear        => (4, date.map(|d| i64::from(d.iso_week().year()))),
-                    IsoYearDiv100  => (2, date.map(|d| div_floor(
-                        i64::from(d.iso_week().year()), 100))),
-                    IsoYearMod100  => (2, date.map(|d| mod_floor(
-                        i64::from(d.iso_week().year()), 100))),
-                    Month          => (2, date.map(|d| i64::from(d.month()))),
-                    Day            => (2, date.map(|d| i64::from(d.day()))),
-                    WeekFromSun    => (2, date.map(|d| i64::from(week_from_sun(d)))),
-                    WeekFromMon    => (2, date.map(|d| i64::from(week_from_mon(d)))),
-                    IsoWeek        => (2, date.map(|d| i64::from(d.iso_week().week()))),
-                    NumDaysFromSun => (1, date.map(|d| i64::from(d.weekday()
-                                                                  .num_days_from_sunday()))),
-                    WeekdayFromMon => (1, date.map(|d| i64::from(d.weekday()
-                                                                  .number_from_monday()))),
-                    Ordinal        => (3, date.map(|d| i64::from(d.ordinal()))),
-                    Hour           => (2, time.map(|t| i64::from(t.hour()))),
-                    Hour12         => (2, time.map(|t| i64::from(t.hour12().1))),
-                    Minute         => (2, time.map(|t| i64::from(t.minute()))),
-                    Second         => (2, time.map(|t| i64::from(t.second() +
-                                                        t.nanosecond() / 1_000_000_000))),
-                    Nanosecond     => (9, time.map(|t| i64::from(t.nanosecond() % 1_000_000_000))),
+                    Year           => (4, date.map(|d| d.year() as i64)),
+                    YearDiv100     => (2, date.map(|d| div_floor(d.year() as i64, 100))),
+                    YearMod100     => (2, date.map(|d| mod_floor(d.year() as i64, 100))),
+                    IsoYear        => (4, date.map(|d| d.isoweekdate().0 as i64)),
+                    IsoYearDiv100  => (2, date.map(|d| div_floor(d.isoweekdate().0 as i64, 100))),
+                    IsoYearMod100  => (2, date.map(|d| mod_floor(d.isoweekdate().0 as i64, 100))),
+                    Month          => (2, date.map(|d| d.month() as i64)),
+                    Day            => (2, date.map(|d| d.day() as i64)),
+                    WeekFromSun    => (2, date.map(|d| week_from_sun(d) as i64)),
+                    WeekFromMon    => (2, date.map(|d| week_from_mon(d) as i64)),
+                    IsoWeek        => (2, date.map(|d| d.isoweekdate().1 as i64)),
+                    NumDaysFromSun => (1, date.map(|d| d.weekday().num_days_from_sunday() as i64)),
+                    WeekdayFromMon => (1, date.map(|d| d.weekday().number_from_monday() as i64)),
+                    Ordinal        => (3, date.map(|d| d.ordinal() as i64)),
+                    Hour           => (2, time.map(|t| t.hour() as i64)),
+                    Hour12         => (2, time.map(|t| t.hour12().1 as i64)),
+                    Minute         => (2, time.map(|t| t.minute() as i64)),
+                    Second         => (2, time.map(|t| (t.second() +
+                                                        t.nanosecond() / 1_000_000_000) as i64)),
+                    Nanosecond     => (9, time.map(|t| (t.nanosecond() % 1_000_000_000) as i64)),
                     Timestamp      => (1, match (date, time, off) {
                         (Some(d), Some(t), None) =>
                             Some(d.and_time(*t).timestamp()),
                         (Some(d), Some(t), Some(&(_, off))) =>
                             Some((d.and_time(*t) - off).timestamp()),
                         (_, _, _) => None
                     }),
-
-                    // for the future expansion
-                    Internal(ref int) => match int._dummy {},
                 };
 
                 if let Some(v) = v {
-                    if (spec == Year || spec == IsoYear) && !(0 <= v && v < 10_000) {
+                    if (spec == Year || spec == IsoYear) && !(0 <= v && v < 10000) {
                         // non-four-digit years require an explicit sign as per ISO 8601
                         match pad {
                             Pad::None => try!(write!(w, "{:+}", v)),
                             Pad::Zero => try!(write!(w, "{:+01$}", v, width + 1)),
                             Pad::Space => try!(write!(w, "{:+1$}", v, width + 1)),
                         }
                     } else {
                         match pad {
@@ -418,25 +328,25 @@ pub fn format<'a, I>(w: &mut fmt::Format
                 }
             },
 
             Item::Fixed(spec) => {
                 use self::Fixed::*;
 
                 /// Prints an offset from UTC in the format of `+HHMM` or `+HH:MM`.
                 /// `Z` instead of `+00[:]00` is allowed when `allow_zulu` is true.
-                fn write_local_minus_utc(w: &mut fmt::Formatter, off: FixedOffset,
+                fn write_local_minus_utc(w: &mut fmt::Formatter, off: Duration,
                                          allow_zulu: bool, use_colon: bool) -> fmt::Result {
-                    let off = off.local_minus_utc();
+                    let off = off.num_minutes();
                     if !allow_zulu || off != 0 {
                         let (sign, off) = if off < 0 {('-', -off)} else {('+', off)};
                         if use_colon {
-                            write!(w, "{}{:02}:{:02}", sign, off / 3600, off / 60 % 60)
+                            write!(w, "{}{:02}:{:02}", sign, off / 60, off % 60)
                         } else {
-                            write!(w, "{}{:02}{:02}", sign, off / 3600, off / 60 % 60)
+                            write!(w, "{}{:02}{:02}", sign, off / 60, off % 60)
                         }
                     } else {
                         write!(w, "Z")
                     }
                 }
 
                 let ret = match spec {
                     ShortMonthName =>
@@ -476,43 +386,26 @@ pub fn format<'a, I>(w: &mut fmt::Format
                             let nano = t.nanosecond() % 1_000_000_000;
                             write!(w, ".{:06}", nano / 1_000)
                         }),
                     Nanosecond9 =>
                         time.map(|t| {
                             let nano = t.nanosecond() % 1_000_000_000;
                             write!(w, ".{:09}", nano)
                         }),
-                    Internal(InternalFixed { val: InternalInternal::Nanosecond3NoDot }) =>
-                        time.map(|t| {
-                            let nano = t.nanosecond() % 1_000_000_000;
-                            write!(w, "{:03}", nano / 1_000_000)
-                        }),
-                    Internal(InternalFixed { val: InternalInternal::Nanosecond6NoDot }) =>
-                        time.map(|t| {
-                            let nano = t.nanosecond() % 1_000_000_000;
-                            write!(w, "{:06}", nano / 1_000)
-                        }),
-                    Internal(InternalFixed { val: InternalInternal::Nanosecond9NoDot }) =>
-                        time.map(|t| {
-                            let nano = t.nanosecond() % 1_000_000_000;
-                            write!(w, "{:09}", nano)
-                        }),
                     TimezoneName =>
                         off.map(|&(ref name, _)| write!(w, "{}", *name)),
                     TimezoneOffsetColon =>
                         off.map(|&(_, off)| write_local_minus_utc(w, off, false, true)),
                     TimezoneOffsetColonZ =>
                         off.map(|&(_, off)| write_local_minus_utc(w, off, true, true)),
                     TimezoneOffset =>
                         off.map(|&(_, off)| write_local_minus_utc(w, off, false, false)),
                     TimezoneOffsetZ =>
                         off.map(|&(_, off)| write_local_minus_utc(w, off, true, false)),
-                    Internal(InternalFixed { val: InternalInternal::TimezoneOffsetPermissive }) =>
-                        panic!("Do not try to write %#z it is undefined"),
                     RFC2822 => // same to `%a, %e %b %Y %H:%M:%S %z`
                         if let (Some(d), Some(t), Some(&(_, off))) = (date, time, off) {
                             let sec = t.second() + t.nanosecond() / 1_000_000_000;
                             try!(write!(w, "{}, {:2} {} {:04} {:02}:{:02}:{:02} ",
                                         SHORT_WEEKDAYS[d.weekday().num_days_from_monday() as usize],
                                         d.day(), SHORT_MONTHS[d.month0() as usize], d.year(),
                                         t.hour(), t.minute(), sec));
                             Some(write_local_minus_utc(w, off, false, false))
@@ -538,88 +431,51 @@ pub fn format<'a, I>(w: &mut fmt::Format
 
             Item::Error => return Err(fmt::Error),
         }
     }
 
     Ok(())
 }
 
-mod parsed;
+pub mod parsed;
 
 // due to the size of parsing routines, they are in separate modules.
 mod scan;
 mod parse;
 
 pub mod strftime;
 
 /// A *temporary* object which can be used as an argument to `format!` or others.
 /// This is normally constructed via `format` methods of each date and time type.
 #[derive(Debug)]
 pub struct DelayedFormat<I> {
     /// The date view, if any.
     date: Option<NaiveDate>,
     /// The time view, if any.
     time: Option<NaiveTime>,
     /// The name and local-to-UTC difference for the offset (timezone), if any.
-    off: Option<(String, FixedOffset)>,
+    off: Option<(String, Duration)>,
     /// An iterator returning formatting items.
     items: I,
 }
 
 impl<'a, I: Iterator<Item=Item<'a>> + Clone> DelayedFormat<I> {
     /// Makes a new `DelayedFormat` value out of local date and time.
     pub fn new(date: Option<NaiveDate>, time: Option<NaiveTime>, items: I) -> DelayedFormat<I> {
         DelayedFormat { date: date, time: time, off: None, items: items }
     }
 
     /// Makes a new `DelayedFormat` value out of local date and time and UTC offset.
     pub fn new_with_offset<Off>(date: Option<NaiveDate>, time: Option<NaiveTime>,
                                 offset: &Off, items: I) -> DelayedFormat<I>
             where Off: Offset + fmt::Display {
-        let name_and_diff = (offset.to_string(), offset.fix());
+        let name_and_diff = (offset.to_string(), offset.local_minus_utc());
         DelayedFormat { date: date, time: time, off: Some(name_and_diff), items: items }
     }
 }
 
 impl<'a, I: Iterator<Item=Item<'a>> + Clone> fmt::Display for DelayedFormat<I> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         format(f, self.date.as_ref(), self.time.as_ref(), self.off.as_ref(), self.items.clone())
     }
 }
 
-// this implementation is here only because we need some private code from `scan`
-
-/// Parsing a `str` into a `Weekday` uses the format [`%W`](./format/strftime/index.html).
-///
-/// # Example
-///
-/// ~~~~
-/// use chrono::Weekday;
-///
-/// assert_eq!("Sunday".parse::<Weekday>(), Ok(Weekday::Sun));
-/// assert!("any day".parse::<Weekday>().is_err());
-/// ~~~~
-///
-/// The parsing is case-insensitive.
-///
-/// ~~~~
-/// # use chrono::Weekday;
-/// assert_eq!("mON".parse::<Weekday>(), Ok(Weekday::Mon));
-/// ~~~~
-///
-/// Only the shortest form (e.g. `sun`) and the longest form (e.g. `sunday`) is accepted.
-///
-/// ~~~~
-/// # use chrono::Weekday;
-/// assert!("thurs".parse::<Weekday>().is_err());
-/// ~~~~
-impl FromStr for Weekday {
-    type Err = ParseWeekdayError;
-
-    fn from_str(s: &str) -> Result<Self, Self::Err> {
-        if let Ok(("", w)) = scan::short_or_long_weekday(s) {
-            Ok(w)
-        } else {
-            Err(ParseWeekdayError { _dummy: () })
-        }
-    }
-}
--- a/third_party/rust/chrono/src/format/parse.rs
+++ b/third_party/rust/chrono/src/format/parse.rs
@@ -1,20 +1,21 @@
-// This is a part of Chrono.
+// This is a part of rust-chrono.
+// Copyright (c) 2015, Kang Seonghoon.
 // Portions copyright (c) 2015, John Nagle.
 // See README.md and LICENSE.txt for details.
 
 //! Date and time parsing routines.
 
 use std::usize;
 
 use Weekday;
 
 use super::scan;
-use super::{Parsed, ParseResult, Item, InternalFixed, InternalInternal};
+use super::{Parsed, ParseResult, Item};
 use super::{OUT_OF_RANGE, INVALID, TOO_SHORT, TOO_LONG, BAD_FORMAT};
 
 fn set_weekday_with_num_days_from_sunday(p: &mut Parsed, v: i64) -> ParseResult<()> {
     p.set_weekday(match v {
         0 => Weekday::Sun, 1 => Weekday::Mon, 2 => Weekday::Tue,
         3 => Weekday::Wed, 4 => Weekday::Thu, 5 => Weekday::Fri,
         6 => Weekday::Sat, _ => return Err(OUT_OF_RANGE)
     })
@@ -80,25 +81,25 @@ fn parse_rfc2822<'a>(parsed: &mut Parsed
     // - zones can range from `-9959` to `+9959`, but `FixedOffset` does not
     //   support offsets larger than 24 hours. this is not *that* problematic
     //   since we do not directly go to a `DateTime` so one can recover
     //   the offset information from `Parsed` anyway.
 
     s = s.trim_left();
 
     if let Ok((s_, weekday)) = scan::short_weekday(s) {
-        if !s_.starts_with(',') { return Err(INVALID); }
+        if !s_.starts_with(",") { return Err(INVALID); }
         s = &s_[1..];
         try!(parsed.set_weekday(weekday));
     }
 
     s = s.trim_left();
     try!(parsed.set_day(try_consume!(scan::number(s, 1, 2))));
     s = try!(scan::space(s)); // mandatory
-    try!(parsed.set_month(1 + i64::from(try_consume!(scan::short_month0(s)))));
+    try!(parsed.set_month(1 + try_consume!(scan::short_month0(s)) as i64));
     s = try!(scan::space(s)); // mandatory
 
     // distinguish two- and three-digit years from four-digit years
     let prevlen = s.len();
     let mut year = try_consume!(scan::number(s, 2, usize::MAX));
     let yearlen = prevlen - s.len();
     match (yearlen, year) {
         (2,  0...49) => { year += 2000; } //   47 -> 2047,   05 -> 2005
@@ -107,24 +108,26 @@ fn parse_rfc2822<'a>(parsed: &mut Parsed
         (_,       _) => {}                // 1987 -> 1987, 0654 -> 0654
     }
     try!(parsed.set_year(year));
 
     s = try!(scan::space(s)); // mandatory
     try!(parsed.set_hour(try_consume!(scan::number(s, 2, 2))));
     s = try!(scan::char(s.trim_left(), b':')).trim_left(); // *S ":" *S
     try!(parsed.set_minute(try_consume!(scan::number(s, 2, 2))));
-    if let Ok(s_) = scan::char(s.trim_left(), b':') { // [ ":" *S 2DIGIT ]
-        try!(parsed.set_second(try_consume!(scan::number(s_, 2, 2))));
+    s = s.trim_left();
+    if !s.is_empty() { // [ ":" *S 2DIGIT ]
+        s = try!(scan::char(s, b':')).trim_left();
+        try!(parsed.set_second(try_consume!(scan::number(s, 2, 2))));
     }
 
     s = try!(scan::space(s)); // mandatory
     if let Some(offset) = try_consume!(scan::timezone_offset_2822(s)) {
         // only set the offset when it is definitely known (i.e. not `-0000`)
-        try!(parsed.set_offset(i64::from(offset)));
+        try!(parsed.set_offset(offset as i64));
     }
 
     Ok((s, ()))
 }
 
 fn parse_rfc3339<'a>(parsed: &mut Parsed, mut s: &'a str) -> ParseResult<(&'a str, ())> {
     macro_rules! try_consume {
         ($e:expr) => ({ let (s_, v) = try!($e); s = s_; v })
@@ -169,24 +172,24 @@ fn parse_rfc3339<'a>(parsed: &mut Parsed
         None => return Err(TOO_SHORT),
     };
 
     try!(parsed.set_hour(try_consume!(scan::number(s, 2, 2))));
     s = try!(scan::char(s, b':'));
     try!(parsed.set_minute(try_consume!(scan::number(s, 2, 2))));
     s = try!(scan::char(s, b':'));
     try!(parsed.set_second(try_consume!(scan::number(s, 2, 2))));
-    if s.starts_with('.') {
+    if s.starts_with(".") {
         let nanosecond = try_consume!(scan::nanosecond(&s[1..]));
         try!(parsed.set_nanosecond(nanosecond));
     }
 
     let offset = try_consume!(scan::timezone_offset_zulu(s, |s| scan::char(s, b':')));
-    if offset <= -86_400 || offset >= 86_400 { return Err(OUT_OF_RANGE); }
-    try!(parsed.set_offset(i64::from(offset)));
+    if offset <= -86400 || offset >= 86400 { return Err(OUT_OF_RANGE); }
+    try!(parsed.set_offset(offset as i64));
 
     Ok((s, ()))
 }
 
 /// Tries to parse given string into `parsed` with given formatting items.
 /// Returns `Ok` when the entire string has been parsed (otherwise `parsed` should not be used).
 /// There should be no trailing string after parsing;
 /// use a stray [`Item::Space`](./enum.Item.html#variant.Space) to trim whitespaces.
@@ -211,31 +214,25 @@ pub fn parse<'a, I>(parsed: &mut Parsed,
     for item in items {
         match item {
             Item::Literal(prefix) => {
                 if s.len() < prefix.len() { return Err(TOO_SHORT); }
                 if !s.starts_with(prefix) { return Err(INVALID); }
                 s = &s[prefix.len()..];
             }
 
-            Item::OwnedLiteral(ref prefix) => {
-                if s.len() < prefix.len() { return Err(TOO_SHORT); }
-                if !s.starts_with(&prefix[..]) { return Err(INVALID); }
-                s = &s[prefix.len()..];
-            }
-
-            Item::Space(_) | Item::OwnedSpace(_) => {
+            Item::Space(_) => {
                 s = s.trim_left();
             }
 
             Item::Numeric(spec, _pad) => {
                 use super::Numeric::*;
-                type Setter = fn(&mut Parsed, i64) -> ParseResult<()>;
 
-                let (width, signed, set): (usize, bool, Setter) = match spec {
+                let (width, signed, set): (usize, bool,
+                                           fn(&mut Parsed, i64) -> ParseResult<()>) = match spec {
                     Year           => (4, true, Parsed::set_year),
                     YearDiv100     => (2, false, Parsed::set_year_div_100),
                     YearMod100     => (2, false, Parsed::set_year_mod_100),
                     IsoYear        => (4, true, Parsed::set_isoyear),
                     IsoYearDiv100  => (2, false, Parsed::set_isoyear_div_100),
                     IsoYearMod100  => (2, false, Parsed::set_isoyear_mod_100),
                     Month          => (2, false, Parsed::set_month),
                     Day            => (2, false, Parsed::set_day),
@@ -246,27 +243,24 @@ pub fn parse<'a, I>(parsed: &mut Parsed,
                     WeekdayFromMon => (1, false, set_weekday_with_number_from_monday),
                     Ordinal        => (3, false, Parsed::set_ordinal),
                     Hour           => (2, false, Parsed::set_hour),
                     Hour12         => (2, false, Parsed::set_hour12),
                     Minute         => (2, false, Parsed::set_minute),
                     Second         => (2, false, Parsed::set_second),
                     Nanosecond     => (9, false, Parsed::set_nanosecond),
                     Timestamp      => (usize::MAX, false, Parsed::set_timestamp),
-
-                    // for the future expansion
-                    Internal(ref int) => match int._dummy {},
                 };
 
                 s = s.trim_left();
                 let v = if signed {
-                    if s.starts_with('-') {
+                    if s.starts_with("-") {
                         let v = try_consume!(scan::number(&s[1..], 1, usize::MAX));
                         try!(0i64.checked_sub(v).ok_or(OUT_OF_RANGE))
-                    } else if s.starts_with('+') {
+                    } else if s.starts_with("+") {
                         try_consume!(scan::number(&s[1..], 1, usize::MAX))
                     } else {
                         // if there is no explicit sign, we respect the original `width`
                         try_consume!(scan::number(s, 1, width))
                     }
                 } else {
                     try_consume!(scan::number(s, 1, width))
                 };
@@ -274,22 +268,22 @@ pub fn parse<'a, I>(parsed: &mut Parsed,
             }
 
             Item::Fixed(spec) => {
                 use super::Fixed::*;
 
                 match spec {
                     ShortMonthName => {
                         let month0 = try_consume!(scan::short_month0(s));
-                        try!(parsed.set_month(i64::from(month0) + 1));
+                        try!(parsed.set_month(month0 as i64 + 1));
                     }
 
                     LongMonthName => {
                         let month0 = try_consume!(scan::short_or_long_month0(s));
-                        try!(parsed.set_month(i64::from(month0) + 1));
+                        try!(parsed.set_month(month0 as i64 + 1));
                     }
 
                     ShortWeekdayName => {
                         let weekday = try_consume!(scan::short_weekday(s));
                         try!(parsed.set_weekday(weekday));
                     }
 
                     LongWeekdayName => {
@@ -303,58 +297,35 @@ pub fn parse<'a, I>(parsed: &mut Parsed,
                             (b'a',b'm') => false,
                             (b'p',b'm') => true,
                             _ => return Err(INVALID)
                         };
                         try!(parsed.set_ampm(ampm));
                         s = &s[2..];
                     }
 
-                    Nanosecond | Nanosecond3 | Nanosecond6 | Nanosecond9 => {
-                        if s.starts_with('.') {
+                    Nanosecond | Nanosecond3 | Nanosecond6 | Nanosecond9=> {
+                        if s.starts_with(".") {
                             let nano = try_consume!(scan::nanosecond(&s[1..]));
                             try!(parsed.set_nanosecond(nano));
                         }
                     }
 
-                    Internal(InternalFixed { val: InternalInternal::Nanosecond3NoDot }) => {
-                        if s.len() < 3 { return Err(TOO_SHORT); }
-                        let nano = try_consume!(scan::nanosecond_fixed(s, 3));
-                        try!(parsed.set_nanosecond(nano));
-                    }
-
-                    Internal(InternalFixed { val: InternalInternal::Nanosecond6NoDot }) => {
-                        if s.len() < 6 { return Err(TOO_SHORT); }
-                        let nano = try_consume!(scan::nanosecond_fixed(s, 6));
-                        try!(parsed.set_nanosecond(nano));
-                    }
-
-                    Internal(InternalFixed { val: InternalInternal::Nanosecond9NoDot }) => {
-                        if s.len() < 9 { return Err(TOO_SHORT); }
-                        let nano = try_consume!(scan::nanosecond_fixed(s, 9));
-                        try!(parsed.set_nanosecond(nano));
-                    }
-
                     TimezoneName => return Err(BAD_FORMAT),
 
                     TimezoneOffsetColon | TimezoneOffset => {
                         let offset = try_consume!(scan::timezone_offset(s.trim_left(),
                                                                         scan::colon_or_space));
-                        try!(parsed.set_offset(i64::from(offset)));
+                        try!(parsed.set_offset(offset as i64));
                     }
 
                     TimezoneOffsetColonZ | TimezoneOffsetZ => {
                         let offset = try_consume!(scan::timezone_offset_zulu(s.trim_left(),
                                                                              scan::colon_or_space));
-                        try!(parsed.set_offset(i64::from(offset)));
-                    }
-                    Internal(InternalFixed { val: InternalInternal::TimezoneOffsetPermissive }) => {
-                        let offset = try_consume!(scan::timezone_offset_permissive(
-                            s.trim_left(), scan::colon_or_space));
-                        try!(parsed.set_offset(i64::from(offset)));
+                        try!(parsed.set_offset(offset as i64));
                     }
 
                     RFC2822 => try_consume!(parse_rfc2822(parsed, s)),
                     RFC3339 => try_consume!(parse_rfc3339(parsed, s)),
                 }
             }
 
             Item::Error => {
@@ -383,21 +354,19 @@ fn test_parse() {
         try!(parse(&mut parsed, s, items.iter().cloned()));
         Ok(parsed)
     }
 
     macro_rules! check {
         ($fmt:expr, $items:expr; $err:tt) => (
             assert_eq!(parse_all($fmt, &$items), Err($err))
         );
-        ($fmt:expr, $items:expr; $($k:ident: $v:expr),*) => (#[allow(unused_mut)] {
-            let mut expected = Parsed::new();
-            $(expected.$k = Some($v);)*
-            assert_eq!(parse_all($fmt, &$items), Ok(expected))
-        });
+        ($fmt:expr, $items:expr; $($k:ident: $v:expr),*) => (
+            assert_eq!(parse_all($fmt, &$items), Ok(Parsed { $($k: Some($v),)* ..Parsed::new() }))
+        );
     }
 
     // empty string
     check!("",  []; );
     check!(" ", []; TOO_LONG);
     check!("a", []; TOO_LONG);
 
     // whitespaces
@@ -547,49 +516,16 @@ fn test_parse() {
     check!(".421950803547", [fix!(Nanosecond)]; nanosecond: 421_950_803);
     check!(".000000003547", [fix!(Nanosecond)]; nanosecond: 3);
     check!(".000000000547", [fix!(Nanosecond)]; nanosecond: 0);
     check!(".",             [fix!(Nanosecond)]; TOO_SHORT);
     check!(".4x",           [fix!(Nanosecond)]; TOO_LONG);
     check!(".  4",          [fix!(Nanosecond)]; INVALID);
     check!("  .4",          [fix!(Nanosecond)]; TOO_LONG); // no automatic trimming
 
-    // fixed: nanoseconds without the dot
-    check!("",             [internal_fix!(Nanosecond3NoDot)]; TOO_SHORT);
-    check!("0",            [internal_fix!(Nanosecond3NoDot)]; TOO_SHORT);
-    check!("4",            [internal_fix!(Nanosecond3NoDot)]; TOO_SHORT);
-    check!("42",           [internal_fix!(Nanosecond3NoDot)]; TOO_SHORT);
-    check!("421",          [internal_fix!(Nanosecond3NoDot)]; nanosecond: 421_000_000);
-    check!("42143",        [internal_fix!(Nanosecond3NoDot), num!(Second)]; nanosecond: 421_000_000, second: 43);
-    check!("42195",        [internal_fix!(Nanosecond3NoDot)]; TOO_LONG);
-    check!("4x",           [internal_fix!(Nanosecond3NoDot)]; TOO_SHORT);
-    check!("  4",          [internal_fix!(Nanosecond3NoDot)]; INVALID);
-    check!(".421",         [internal_fix!(Nanosecond3NoDot)]; INVALID);
-
-    check!("",             [internal_fix!(Nanosecond6NoDot)]; TOO_SHORT);
-    check!("0",            [internal_fix!(Nanosecond6NoDot)]; TOO_SHORT);
-    check!("42195",        [internal_fix!(Nanosecond6NoDot)]; TOO_SHORT);
-    check!("421950",       [internal_fix!(Nanosecond6NoDot)]; nanosecond: 421_950_000);
-    check!("000003",       [internal_fix!(Nanosecond6NoDot)]; nanosecond: 3000);
-    check!("000000",       [internal_fix!(Nanosecond6NoDot)]; nanosecond: 0);
-    check!("4x",           [internal_fix!(Nanosecond6NoDot)]; TOO_SHORT);
-    check!("     4",       [internal_fix!(Nanosecond6NoDot)]; INVALID);
-    check!(".42100",       [internal_fix!(Nanosecond6NoDot)]; INVALID);
-
-    check!("",             [internal_fix!(Nanosecond9NoDot)]; TOO_SHORT);
-    check!("42195",        [internal_fix!(Nanosecond9NoDot)]; TOO_SHORT);
-    check!("421950803",    [internal_fix!(Nanosecond9NoDot)]; nanosecond: 421_950_803);
-    check!("000000003",    [internal_fix!(Nanosecond9NoDot)]; nanosecond: 3);
-    check!("42195080354",  [internal_fix!(Nanosecond9NoDot), num!(Second)]; nanosecond: 421_950_803, second: 54); // don't skip digits that come after the 9
-    check!("421950803547", [internal_fix!(Nanosecond9NoDot)]; TOO_LONG);
-    check!("000000000",    [internal_fix!(Nanosecond9NoDot)]; nanosecond: 0);
-    check!("00000000x",    [internal_fix!(Nanosecond9NoDot)]; INVALID);
-    check!("        4",    [internal_fix!(Nanosecond9NoDot)]; INVALID);
-    check!(".42100000",    [internal_fix!(Nanosecond9NoDot)]; INVALID);
-
     // fixed: timezone offsets
     check!("+00:00",    [fix!(TimezoneOffset)]; offset: 0);
     check!("-00:00",    [fix!(TimezoneOffset)]; offset: 0);
     check!("+00:01",    [fix!(TimezoneOffset)]; offset: 60);
     check!("-00:01",    [fix!(TimezoneOffset)]; offset: -60);
     check!("+00:30",    [fix!(TimezoneOffset)]; offset: 30 * 60);
     check!("-00:30",    [fix!(TimezoneOffset)]; offset: -30 * 60);
     check!("+04:56",    [fix!(TimezoneOffset)]; offset: 296 * 60);
@@ -618,33 +554,24 @@ fn test_parse() {
     check!("z",         [fix!(TimezoneOffset)]; INVALID);
     check!("Z",         [fix!(TimezoneOffsetZ)]; offset: 0);
     check!("z",         [fix!(TimezoneOffsetZ)]; offset: 0);
     check!("Y",         [fix!(TimezoneOffsetZ)]; INVALID);
     check!("Zulu",      [fix!(TimezoneOffsetZ), lit!("ulu")]; offset: 0);
     check!("zulu",      [fix!(TimezoneOffsetZ), lit!("ulu")]; offset: 0);
     check!("+1234ulu",  [fix!(TimezoneOffsetZ), lit!("ulu")]; offset: 754 * 60);
     check!("+12:34ulu", [fix!(TimezoneOffsetZ), lit!("ulu")]; offset: 754 * 60);
-    check!("Z",         [internal_fix!(TimezoneOffsetPermissive)]; offset: 0);
-    check!("z",         [internal_fix!(TimezoneOffsetPermissive)]; offset: 0);
-    check!("+12:00",    [internal_fix!(TimezoneOffsetPermissive)]; offset: 12 * 60 * 60);
-    check!("+12",       [internal_fix!(TimezoneOffsetPermissive)]; offset: 12 * 60 * 60);
     check!("???",       [fix!(TimezoneName)]; BAD_FORMAT); // not allowed
 
     // some practical examples
     check!("2015-02-04T14:37:05+09:00",
            [num!(Year), lit!("-"), num!(Month), lit!("-"), num!(Day), lit!("T"),
             num!(Hour), lit!(":"), num!(Minute), lit!(":"), num!(Second), fix!(TimezoneOffset)];
            year: 2015, month: 2, day: 4, hour_div_12: 1, hour_mod_12: 2,
            minute: 37, second: 5, offset: 32400);
-    check!("20150204143705567",
-            [num!(Year), num!(Month), num!(Day),
-            num!(Hour), num!(Minute), num!(Second), internal_fix!(Nanosecond3NoDot)];
-            year: 2015, month: 2, day: 4, hour_div_12: 1, hour_mod_12: 2,
-            minute: 37, second: 5, nanosecond: 567000000);
     check!("Mon, 10 Jun 2013 09:32:37 GMT",
            [fix!(ShortWeekdayName), lit!(","), sp!(" "), num!(Day), sp!(" "),
             fix!(ShortMonthName), sp!(" "), num!(Year), sp!(" "), num!(Hour), lit!(":"),
             num!(Minute), lit!(":"), num!(Second), sp!(" "), lit!("GMT")];
            year: 2013, month: 6, day: 10, weekday: Weekday::Mon,
            hour_div_12: 0, hour_mod_12: 9, minute: 32, second: 37);
     check!("20060102150405",
            [num!(Year), num!(Month), num!(Day), num!(Hour), num!(Minute), num!(Second)];
@@ -658,27 +585,26 @@ fn test_parse() {
     check!("12345678901234.56789",
            [num!(Timestamp), fix!(Nanosecond)];
            nanosecond: 567_890_000, timestamp: 12_345_678_901_234);
 }
 
 #[cfg(test)]
 #[test]
 fn test_rfc2822() {
-    use DateTime;
-    use offset::FixedOffset;
+    use datetime::DateTime;
+    use offset::fixed::FixedOffset;
     use super::*;
     use super::NOT_ENOUGH;
 
     // Test data - (input, Ok(expected result after parse and format) or Err(error code))
     let testdates = [
         ("Tue, 20 Jan 2015 17:35:20 -0800", Ok("Tue, 20 Jan 2015 17:35:20 -0800")), // normal case
         ("20 Jan 2015 17:35:20 -0800", Ok("Tue, 20 Jan 2015 17:35:20 -0800")),  // no day of week
         ("20 JAN 2015 17:35:20 -0800", Ok("Tue, 20 Jan 2015 17:35:20 -0800")),  // upper case month
-        ("Tue, 20 Jan 2015 17:35 -0800", Ok("Tue, 20 Jan 2015 17:35:00 -0800")), // no second
         ("11 Sep 2001 09:45:00 EST", Ok("Tue, 11 Sep 2001 09:45:00 -0500")),
         ("30 Feb 2015 17:35:20 -0800", Err(OUT_OF_RANGE)),      // bad day of month
         ("Tue, 20 Jan 2015", Err(TOO_SHORT)),                   // omitted fields
         ("Tue, 20 Avr 2015 17:35:20 -0800", Err(INVALID)),      // bad month name
         ("Tue, 20 Jan 2015 25:35:20 -0800", Err(OUT_OF_RANGE)), // bad hour
         ("Tue, 20 Jan 2015 7:35:20 -0800", Err(INVALID)),       // bad # of digits in hour
         ("Tue, 20 Jan 2015 17:65:20 -0800", Err(OUT_OF_RANGE)), // bad minute
         ("Tue, 20 Jan 2015 17:35:90 -0800", Err(OUT_OF_RANGE)), // bad second
@@ -711,50 +637,50 @@ fn test_rfc2822() {
     };
 }
 
 
 
 #[cfg(test)]
 #[test]
 fn parse_rfc850() {
-    use ::{Utc, TimeZone};
+    use ::{UTC, TimeZone};
 
     static RFC850_FMT: &'static str =  "%A, %d-%b-%y %T GMT";
 
     let dt_str = "Sunday, 06-Nov-94 08:49:37 GMT";
-    let dt = Utc.ymd(1994, 11, 6).and_hms(8, 49, 37);
+    let dt = UTC.ymd(1994, 11, 6).and_hms(8, 49, 37);
 
     // Check that the format is what we expect
     assert_eq!(dt.format(RFC850_FMT).to_string(), dt_str);
 
     // Check that it parses correctly
-    assert_eq!(Ok(dt), Utc.datetime_from_str("Sunday, 06-Nov-94 08:49:37 GMT", RFC850_FMT));
+    assert_eq!(Ok(dt), UTC.datetime_from_str("Sunday, 06-Nov-94 08:49:37 GMT", RFC850_FMT));
 
     // Check that the rest of the weekdays parse correctly (this test originally failed because
     // Sunday parsed incorrectly).
     let testdates = [
-        (Utc.ymd(1994, 11, 7).and_hms(8, 49, 37),  "Monday, 07-Nov-94 08:49:37 GMT"),
-        (Utc.ymd(1994, 11, 8).and_hms(8, 49, 37),  "Tuesday, 08-Nov-94 08:49:37 GMT"),
-        (Utc.ymd(1994, 11, 9).and_hms(8, 49, 37),  "Wednesday, 09-Nov-94 08:49:37 GMT"),
-        (Utc.ymd(1994, 11, 10).and_hms(8, 49, 37), "Thursday, 10-Nov-94 08:49:37 GMT"),
-        (Utc.ymd(1994, 11, 11).and_hms(8, 49, 37), "Friday, 11-Nov-94 08:49:37 GMT"),
-        (Utc.ymd(1994, 11, 12).and_hms(8, 49, 37), "Saturday, 12-Nov-94 08:49:37 GMT"),
+        (UTC.ymd(1994, 11, 7).and_hms(8, 49, 37),  "Monday, 07-Nov-94 08:49:37 GMT"),
+        (UTC.ymd(1994, 11, 8).and_hms(8, 49, 37),  "Tuesday, 08-Nov-94 08:49:37 GMT"),
+        (UTC.ymd(1994, 11, 9).and_hms(8, 49, 37),  "Wednesday, 09-Nov-94 08:49:37 GMT"),
+        (UTC.ymd(1994, 11, 10).and_hms(8, 49, 37), "Thursday, 10-Nov-94 08:49:37 GMT"),
+        (UTC.ymd(1994, 11, 11).and_hms(8, 49, 37), "Friday, 11-Nov-94 08:49:37 GMT"),
+        (UTC.ymd(1994, 11, 12).and_hms(8, 49, 37), "Saturday, 12-Nov-94 08:49:37 GMT"),
     ];
 
     for val in &testdates {
-        assert_eq!(Ok(val.0), Utc.datetime_from_str(val.1, RFC850_FMT));
+        assert_eq!(Ok(val.0), UTC.datetime_from_str(val.1, RFC850_FMT));
     }
 }
 
 #[cfg(test)]
 #[test]
 fn test_rfc3339() {
-    use DateTime;
-    use offset::FixedOffset;
+    use datetime::DateTime;
+    use offset::fixed::FixedOffset;
     use super::*;
 
     // Test data - (input, Ok(expected result after parse and format) or Err(error code))
     let testdates = [
         ("2015-01-20T17:35:20-08:00", Ok("2015-01-20T17:35:20-08:00")), // normal case
         ("1944-06-06T04:04:00Z", Ok("1944-06-06T04:04:00+00:00")),      // D-day
         ("2001-09-11T09:45:00-08:00", Ok("2001-09-11T09:45:00-08:00")),
         ("2015-01-20T17:35:20.001-08:00", Ok("2015-01-20T17:35:20.001-08:00")),
--- a/third_party/rust/chrono/src/format/parsed.rs
+++ b/third_party/rust/chrono/src/format/parsed.rs
@@ -1,23 +1,27 @@
-// This is a part of Chrono.
+// This is a part of rust-chrono.
+// Copyright (c) 2015, Kang Seonghoon.
 // See README.md and LICENSE.txt for details.
 
 //! A collection of parsed date and time items.
 //! They can be constructed incrementally while being checked for consistency.
 
-use num_traits::ToPrimitive;
-use oldtime::Duration as OldDuration;
+use num::traits::ToPrimitive;
 
 use {Datelike, Timelike};
 use Weekday;
 use div::div_rem;
-use offset::{TimeZone, Offset, LocalResult, FixedOffset};
-use naive::{NaiveDate, NaiveTime, NaiveDateTime};
-use DateTime;
+use duration::Duration;
+use offset::{TimeZone, Offset, LocalResult};
+use offset::fixed::FixedOffset;
+use naive::date::NaiveDate;
+use naive::time::NaiveTime;
+use naive::datetime::NaiveDateTime;
+use datetime::DateTime;
 use super::{ParseResult, OUT_OF_RANGE, IMPOSSIBLE, NOT_ENOUGH};
 
 /// Parsed parts of date and time. There are two classes of methods:
 ///
 /// - `set_*` methods try to set given field(s) while checking for the consistency.
 ///   It may or may not check for the range constraint immediately (for efficiency reasons).
 ///
 /// - `to_*` methods try to make a concrete date and time value out of set fields.
@@ -36,46 +40,46 @@ pub struct Parsed {
     /// Due to the common usage, if this field is missing but
     /// [`year_mod_100`](#structfield.year_mod_100) is present,
     /// it is inferred to 19 when `year_mod_100 >= 70` and 20 otherwise.
     pub year_div_100: Option<i32>,
 
     /// Year modulo 100. Implies that the year is >= 1 BCE when set.
     pub year_mod_100: Option<i32>,
 
-    /// Year in the [ISO week date](../naive/struct.NaiveDate.html#week-date).
+    /// Year in the [ISO week date](../../naive/date/index.html#week-date).
     ///
     /// This can be negative unlike [`isoyear_div_100`](#structfield.isoyear_div_100) and
     /// [`isoyear_mod_100`](#structfield.isoyear_mod_100) fields.
     pub isoyear: Option<i32>,
 
-    /// Year in the [ISO week date](../naive/struct.NaiveDate.html#week-date), divided by 100.
+    /// Year in the [ISO week date](../../naive/date/index.html#week-date), divided by 100.
     /// Implies that the year is >= 1 BCE when set.
     ///
     /// Due to the common usage, if this field is missing but
     /// [`isoyear_mod_100`](#structfield.isoyear_mod_100) is present,
     /// it is inferred to 19 when `isoyear_mod_100 >= 70` and 20 otherwise.
     pub isoyear_div_100: Option<i32>,
 
-    /// Year in the [ISO week date](../naive/struct.NaiveDate.html#week-date), modulo 100.
+    /// Year in the [ISO week date](../../naive/date/index.html#week-date), modulo 100.
     /// Implies that the year is >= 1 BCE when set.
     pub isoyear_mod_100: Option<i32>,
 
     /// Month (1--12).
     pub month: Option<u32>,
 
     /// Week number, where the week 1 starts at the first Sunday of January
     /// (0--53, 1--53 or 1--52 depending on the year).
     pub week_from_sun: Option<u32>,
 
     /// Week number, where the week 1 starts at the first Monday of January
     /// (0--53, 1--53 or 1--52 depending on the year).
     pub week_from_mon: Option<u32>,
 
-    /// [ISO week number](../naive/struct.NaiveDate.html#week-date)
+    /// [ISO week number](../../naive/date/index.html#week-date)
     /// (1--52 or 1--53 depending on the year).
     pub isoweek: Option<u32>,
 
     /// Day of the week.
     pub weekday: Option<Weekday>,
 
     /// Day of the year (1--365 or 1--366 depending on the year).
     pub ordinal: Option<u32>,
@@ -100,49 +104,37 @@ pub struct Parsed {
 
     /// The number of non-leap seconds since the midnight UTC on January 1, 1970.
     ///
     /// This can be off by one if [`second`](#structfield.second) is 60 (a leap second).
     pub timestamp: Option<i64>,
 
     /// Offset from the local time to UTC, in seconds.
     pub offset: Option<i32>,
-
-    /// A dummy field to make this type not fully destructible (required for API stability).
-    _dummy: (),
 }
 
 /// Checks if `old` is either empty or has the same value to `new` (i.e. "consistent"),
 /// and if it is empty, set `old` to `new` as well.
 fn set_if_consistent<T: PartialEq>(old: &mut Option<T>, new: T) -> ParseResult<()> {
     if let Some(ref old) = *old {
         if *old == new {Ok(())} else {Err(IMPOSSIBLE)}
     } else {
         *old = Some(new);
         Ok(())
     }
 }
 
-impl Default for Parsed {
-    fn default() -> Parsed {
-        Parsed {
-            year: None, year_div_100: None, year_mod_100: None, isoyear: None,
-            isoyear_div_100: None, isoyear_mod_100: None, month: None,
-            week_from_sun: None, week_from_mon: None, isoweek: None, weekday: None,
-            ordinal: None, day: None, hour_div_12: None, hour_mod_12: None, minute: None,
-            second: None, nanosecond: None, timestamp: None, offset: None,
-            _dummy: (),
-        }
-    }
-}
-
 impl Parsed {
     /// Returns the initial value of parsed parts.
     pub fn new() -> Parsed {
-        Parsed::default()
+        Parsed { year: None, year_div_100: None, year_mod_100: None, isoyear: None,
+                 isoyear_div_100: None, isoyear_mod_100: None, month: None,
+                 week_from_sun: None, week_from_mon: None, isoweek: None, weekday: None,
+                 ordinal: None, day: None, hour_div_12: None, hour_mod_12: None, minute: None,
+                 second: None, nanosecond: None, timestamp: None, offset: None }
     }
 
     /// Tries to set the [`year`](#structfield.year) field from given value.
     pub fn set_year(&mut self, value: i64) -> ParseResult<()> {
         set_if_consistent(&mut self.year, try!(value.to_i32().ok_or(OUT_OF_RANGE)))
     }
 
     /// Tries to set the [`year_div_100`](#structfield.year_div_100) field from given value.
@@ -327,20 +319,17 @@ impl Parsed {
              self.year_div_100.or(year_div_100) == year_div_100 &&
              self.year_mod_100.or(year_mod_100) == year_mod_100 &&
              self.month.unwrap_or(month) == month &&
              self.day.unwrap_or(day) == day)
         };
 
         // verify the ISO week date.
         let verify_isoweekdate = |date: NaiveDate| {
-            let week = date.iso_week();
-            let isoyear = week.year();
-            let isoweek = week.week();
-            let weekday = date.weekday();
+            let (isoyear, isoweek, weekday) = date.isoweekdate();
             let (isoyear_div_100, isoyear_mod_100) = if isoyear >= 0 {
                 let (q, r) = div_rem(isoyear, 100);
                 (Some(q), Some(r))
             } else {
                 (None, None) // they should be empty to be consistent
             };
             (self.isoyear.unwrap_or(isoyear) == isoyear &&
              self.isoyear_div_100.or(isoyear_div_100) == isoyear_div_100 &&
@@ -389,17 +378,17 @@ impl Parsed {
                     Weekday::Fri => 2,
                     Weekday::Sat => 1,
                 };
 
                 // `firstweek+1`-th day of January is the beginning of the week 1.
                 if week_from_sun > 53 { return Err(OUT_OF_RANGE); } // can it overflow?
                 let ndays = firstweek + (week_from_sun as i32 - 1) * 7 +
                             weekday.num_days_from_sunday() as i32;
-                let date = try!(newyear.checked_add_signed(OldDuration::days(i64::from(ndays)))
+                let date = try!(newyear.checked_add(Duration::days(ndays as i64))
                                        .ok_or(OUT_OF_RANGE));
                 if date.year() != year { return Err(OUT_OF_RANGE); } // early exit for correct error
 
                 (verify_ymd(date) && verify_isoweekdate(date) && verify_ordinal(date), date)
             },
 
             (Some(year), _, &Parsed { week_from_mon: Some(week_from_mon),
                                       weekday: Some(weekday), .. }) => {
@@ -414,17 +403,17 @@ impl Parsed {
                     Weekday::Fri => 3,
                     Weekday::Sat => 2,
                 };
 
                 // `firstweek+1`-th day of January is the beginning of the week 1.
                 if week_from_mon > 53 { return Err(OUT_OF_RANGE); } // can it overflow?
                 let ndays = firstweek + (week_from_mon as i32 - 1) * 7 +
                             weekday.num_days_from_monday() as i32;
-                let date = try!(newyear.checked_add_signed(OldDuration::days(i64::from(ndays)))
+                let date = try!(newyear.checked_add(Duration::days(ndays as i64))
                                        .ok_or(OUT_OF_RANGE));
                 if date.year() != year { return Err(OUT_OF_RANGE); } // early exit for correct error
 
                 (verify_ymd(date) && verify_isoweekdate(date) && verify_ordinal(date), date)
             },
 
             (_, Some(isoyear), &Parsed { isoweek: Some(isoweek), weekday: Some(weekday), .. }) => {
                 // ISO year, week, day of the week
@@ -497,17 +486,17 @@ impl Parsed {
     pub fn to_naive_datetime_with_offset(&self, offset: i32) -> ParseResult<NaiveDateTime> {
         let date = self.to_naive_date();
         let time = self.to_naive_time();
         if let (Ok(date), Ok(time)) = (date, time) {
             let datetime = date.and_time(time);
 
             // verify the timestamp field if any
             // the following is safe, `timestamp` is very limited in range
-            let timestamp = datetime.timestamp() - i64::from(offset);
+            let timestamp = datetime.timestamp() - offset as i64;
             if let Some(given_timestamp) = self.timestamp {
                 // if `datetime` represents a leap second, it might be off by one second.
                 if given_timestamp != timestamp &&
                    !(datetime.nanosecond() >= 1_000_000_000 && given_timestamp == timestamp + 1) {
                     return Err(IMPOSSIBLE);
                 }
             }
 
@@ -520,57 +509,58 @@ impl Parsed {
             // we at least try to give a correct error though.
             match (date, time) {
                 (Err(PE(OutOfRange)), _) | (_, Err(PE(OutOfRange))) => return Err(OUT_OF_RANGE),
                 (Err(PE(Impossible)), _) | (_, Err(PE(Impossible))) => return Err(IMPOSSIBLE),
                 (_, _) => {} // one of them is insufficient
             }
 
             // reconstruct date and time fields from timestamp
-            let ts = try!(timestamp.checked_add(i64::from(offset)).ok_or(OUT_OF_RANGE));
+            let ts = try!(timestamp.checked_add(offset as i64).ok_or(OUT_OF_RANGE));
             let datetime = NaiveDateTime::from_timestamp_opt(ts, 0);
             let mut datetime = try!(datetime.ok_or(OUT_OF_RANGE));
 
             // fill year, ordinal, hour, minute and second fields from timestamp.
             // if existing fields are consistent, this will allow the full date/time reconstruction.
             let mut parsed = self.clone();
             if parsed.second == Some(60) {
                 // `datetime.second()` cannot be 60, so this is the only case for a leap second.
                 match datetime.second() {
                     // it's okay, just do not try to overwrite the existing field.
                     59 => {}
                     // `datetime` is known to be off by one second.
-                    0 => { datetime -= OldDuration::seconds(1); }
+                    0 => { datetime = datetime - Duration::seconds(1); }
                     // otherwise it is impossible.
                     _ => return Err(IMPOSSIBLE)
                 }
                 // ...and we have the correct candidates for other fields.
             } else {
-                try!(parsed.set_second(i64::from(datetime.second())));
+                try!(parsed.set_second(datetime.second() as i64));
             }
-            try!(parsed.set_year   (i64::from(datetime.year())));
-            try!(parsed.set_ordinal(i64::from(datetime.ordinal()))); // more efficient than ymd
-            try!(parsed.set_hour   (i64::from(datetime.hour())));
-            try!(parsed.set_minute (i64::from(datetime.minute())));
+            try!(parsed.set_year   (datetime.year()    as i64));
+            try!(parsed.set_ordinal(datetime.ordinal() as i64)); // more efficient than ymd
+            try!(parsed.set_hour   (datetime.hour()    as i64));
+            try!(parsed.set_minute (datetime.minute()  as i64));
+            try!(parsed.set_nanosecond(0)); // no nanosecond precision in timestamp
 
             // validate other fields (e.g. week) and return
             let date = try!(parsed.to_naive_date());
             let time = try!(parsed.to_naive_time());
             Ok(date.and_time(time))
         } else {
             // reproduce the previous error(s)
             try!(date);
             try!(time);
             unreachable!()
         }
     }
 
     /// Returns a parsed fixed time zone offset out of given fields.
     pub fn to_fixed_offset(&self) -> ParseResult<FixedOffset> {
-        self.offset.and_then(FixedOffset::east_opt).ok_or(OUT_OF_RANGE)
+        self.offset.and_then(|offset| FixedOffset::east_opt(offset)).ok_or(OUT_OF_RANGE)
     }
 
     /// Returns a parsed timezone-aware date and time out of given fields.
     ///
     /// This method is able to determine the combined date and time
     /// from date and time fields or a single [`timestamp`](#structfield.timestamp) field,
     /// plus a time zone offset.
     /// Either way those fields have to be consistent to each other.
@@ -598,23 +588,30 @@ impl Parsed {
         // if we have `timestamp` specified, guess an offset from that.
         let mut guessed_offset = 0;
         if let Some(timestamp) = self.timestamp {
             // make a naive `DateTime` from given timestamp and (if any) nanosecond.
             // an empty `nanosecond` is always equal to zero, so missing nanosecond is fine.
             let nanosecond = self.nanosecond.unwrap_or(0);
             let dt = NaiveDateTime::from_timestamp_opt(timestamp, nanosecond);
             let dt = try!(dt.ok_or(OUT_OF_RANGE));
-            guessed_offset = tz.offset_from_utc_datetime(&dt).fix().local_minus_utc();
+
+            // we cannot handle offsets larger than i32 at all. give up if so.
+            // we can instead make `to_naive_datetime_with_offset` to accept i64, but this makes
+            // the algorithm too complex and tons of edge cases. i32 should be enough for all.
+            let offset = tz.offset_from_utc_datetime(&dt).local_minus_utc().num_seconds();
+            guessed_offset = try!(offset.to_i32().ok_or(OUT_OF_RANGE));
         }
 
         // checks if the given `DateTime` has a consistent `Offset` with given `self.offset`.
         let check_offset = |dt: &DateTime<Tz>| {
             if let Some(offset) = self.offset {
-                dt.offset().fix().local_minus_utc() == offset
+                let delta = dt.offset().local_minus_utc().num_seconds();
+                // if `delta` does not fit in `i32`, it cannot equal to `self.offset` anyway.
+                delta.to_i32() == Some(offset)
             } else {
                 true
             }
         };
 
         // `guessed_offset` should be correct when `self.timestamp` is given.
         // it will be 0 otherwise, but this is fine as the algorithm ignores offset for that case.
         let datetime = try!(self.to_naive_datetime_with_offset(guessed_offset));
@@ -635,18 +632,21 @@ impl Parsed {
 }
 
 #[cfg(test)]
 mod tests {
     use super::Parsed;
     use super::super::{OUT_OF_RANGE, IMPOSSIBLE, NOT_ENOUGH};
     use Datelike;
     use Weekday::*;
-    use naive::{MIN_DATE, MAX_DATE, NaiveDate, NaiveTime};
-    use offset::{TimeZone, Utc, FixedOffset};
+    use naive::date::{self, NaiveDate};
+    use naive::time::NaiveTime;
+    use offset::TimeZone;
+    use offset::utc::UTC;
+    use offset::fixed::FixedOffset;
 
     #[test]
     fn test_parsed_set_fields() {
         // year*, isoyear*
         let mut p = Parsed::new();
         assert_eq!(p.set_year(1987), Ok(()));
         assert_eq!(p.set_year(1986), Err(IMPOSSIBLE));
         assert_eq!(p.set_year(1988), Err(IMPOSSIBLE));
@@ -755,17 +755,17 @@ mod tests {
         assert_eq!(parse!(year_div_100: 19, year_mod_100: 100, month: 1, day: 1),
                    Err(OUT_OF_RANGE));
         assert_eq!(parse!(year_div_100: 19, year_mod_100: -1, month: 1, day: 1),
                    Err(OUT_OF_RANGE));
         assert_eq!(parse!(year_div_100: 0, year_mod_100: 0, month: 1, day: 1),
                    ymd(0, 1, 1));
         assert_eq!(parse!(year_div_100: -1, year_mod_100: 42, month: 1, day: 1),
                    Err(OUT_OF_RANGE));
-        let max_year = MAX_DATE.year();
+        let max_year = date::MAX.year();
         assert_eq!(parse!(year_div_100: max_year / 100,
                           year_mod_100: max_year % 100, month: 1, day: 1),
                    ymd(max_year, 1, 1));
         assert_eq!(parse!(year_div_100: (max_year + 1) / 100,
                           year_mod_100: (max_year + 1) % 100, month: 1, day: 1),
                    Err(OUT_OF_RANGE));
 
         // ymd: conflicting inputs
@@ -927,17 +927,17 @@ mod tests {
         assert_eq!(parse!(year: 1997, month: 1, day: 30,
                           hour_div_12: 1, hour_mod_12: 2, minute: 38, second: 5),
                    ymdhms(1997,1,30, 14,38,5));
         assert_eq!(parse!(year: 2012, ordinal: 34, hour_div_12: 0, hour_mod_12: 5,
                           minute: 6, second: 7, nanosecond: 890_123_456),
                    ymdhmsn(2012,2,3, 5,6,7,890_123_456));
         assert_eq!(parse!(timestamp: 0), ymdhms(1970,1,1, 0,0,0));
         assert_eq!(parse!(timestamp: 1, nanosecond: 0), ymdhms(1970,1,1, 0,0,1));
-        assert_eq!(parse!(timestamp: 1, nanosecond: 1), ymdhmsn(1970,1,1, 0,0,1, 1));
+        assert_eq!(parse!(timestamp: 1, nanosecond: 1), Err(IMPOSSIBLE));
         assert_eq!(parse!(timestamp: 1_420_000_000), ymdhms(2014,12,31, 4,26,40));
         assert_eq!(parse!(timestamp: -0x1_0000_0000), ymdhms(1833,11,24, 17,31,44));
 
         // full fields
         assert_eq!(parse!(year: 2014, year_div_100: 20, year_mod_100: 14, month: 12, day: 31,
                           ordinal: 365, isoyear: 2015, isoyear_div_100: 20, isoyear_mod_100: 15,
                           isoweek: 1, week_from_sun: 52, week_from_mon: 52, weekday: Wed,
                           hour_div_12: 0, hour_mod_12: 4, minute: 26, second: 40,
@@ -953,28 +953,25 @@ mod tests {
                           year: 2014, year_div_100: 20, year_mod_100: 14, month: 12, day: 31,
                           ordinal: 365, isoyear: 2015, isoyear_div_100: 20, isoyear_mod_100: 15,
                           isoweek: 1, week_from_sun: 52, week_from_mon: 52, weekday: Wed,
                           hour_div_12: 0, hour_mod_12: 4, minute: 26, second: 40,
                           nanosecond: 12_345_678, timestamp: 1_419_967_600),
                    ymdhmsn(2014,12,31, 4,26,40,12_345_678));
 
         // more timestamps
-        let max_days_from_year_1970 =
-            MAX_DATE.signed_duration_since(NaiveDate::from_ymd(1970,1,1));
-        let year_0_from_year_1970 =
-            NaiveDate::from_ymd(0,1,1).signed_duration_since(NaiveDate::from_ymd(1970,1,1));
-        let min_days_from_year_1970 =
-            MIN_DATE.signed_duration_since(NaiveDate::from_ymd(1970,1,1));
+        let max_days_from_year_1970 = date::MAX - NaiveDate::from_ymd(1970,1,1);
+        let year_0_from_year_1970 = NaiveDate::from_ymd(0,1,1) - NaiveDate::from_ymd(1970,1,1);
+        let min_days_from_year_1970 = date::MIN - NaiveDate::from_ymd(1970,1,1);
         assert_eq!(parse!(timestamp: min_days_from_year_1970.num_seconds()),
-                   ymdhms(MIN_DATE.year(),1,1, 0,0,0));
+                   ymdhms(date::MIN.year(),1,1, 0,0,0));
         assert_eq!(parse!(timestamp: year_0_from_year_1970.num_seconds()),
                    ymdhms(0,1,1, 0,0,0));
         assert_eq!(parse!(timestamp: max_days_from_year_1970.num_seconds() + 86399),
-                   ymdhms(MAX_DATE.year(),12,31, 23,59,59));
+                   ymdhms(date::MAX.year(),12,31, 23,59,59));
 
         // leap seconds #1: partial fields
         assert_eq!(parse!(second: 59, timestamp: 1_341_100_798), Err(IMPOSSIBLE));
         assert_eq!(parse!(second: 59, timestamp: 1_341_100_799), ymdhms(2012,6,30, 23,59,59));
         assert_eq!(parse!(second: 59, timestamp: 1_341_100_800), Err(IMPOSSIBLE));
         assert_eq!(parse!(second: 60, timestamp: 1_341_100_799),
                    ymdhmsn(2012,6,30, 23,59,59,1_000_000_000));
         assert_eq!(parse!(second: 60, timestamp: 1_341_100_800),
@@ -1036,51 +1033,51 @@ mod tests {
                    ymdhmsn(2014,12,31, 4,26,40,12_345_678, 0));
         assert_eq!(parse!(year: 2014, ordinal: 365, hour_div_12: 1, hour_mod_12: 1,
                           minute: 26, second: 40, nanosecond: 12_345_678, offset: 32400),
                    ymdhmsn(2014,12,31, 13,26,40,12_345_678, 32400));
         assert_eq!(parse!(year: 2014, ordinal: 365, hour_div_12: 0, hour_mod_12: 1,
                           minute: 42, second: 4, nanosecond: 12_345_678, offset: -9876),
                    ymdhmsn(2014,12,31, 1,42,4,12_345_678, -9876));
         assert_eq!(parse!(year: 2015, ordinal: 1, hour_div_12: 0, hour_mod_12: 4,
-                          minute: 26, second: 40, nanosecond: 12_345_678, offset: 86_400),
+                          minute: 26, second: 40, nanosecond: 12_345_678, offset: 86400),
                    Err(OUT_OF_RANGE)); // `FixedOffset` does not support such huge offset
     }
 
     #[test]
     fn test_parsed_to_datetime_with_timezone() {
         macro_rules! parse {
             ($tz:expr; $($k:ident: $v:expr),*) => (
                 Parsed { $($k: Some($v),)* ..Parsed::new() }.to_datetime_with_timezone(&$tz)
             )
         }
 
         // single result from ymdhms
-        assert_eq!(parse!(Utc;
+        assert_eq!(parse!(UTC;
                           year: 2014, ordinal: 365, hour_div_12: 0, hour_mod_12: 4,
                           minute: 26, second: 40, nanosecond: 12_345_678, offset: 0),
-                   Ok(Utc.ymd(2014, 12, 31).and_hms_nano(4, 26, 40, 12_345_678)));
-        assert_eq!(parse!(Utc;
+                   Ok(UTC.ymd(2014, 12, 31).and_hms_nano(4, 26, 40, 12_345_678)));
+        assert_eq!(parse!(UTC;
                           year: 2014, ordinal: 365, hour_div_12: 1, hour_mod_12: 1,
                           minute: 26, second: 40, nanosecond: 12_345_678, offset: 32400),
                    Err(IMPOSSIBLE));
         assert_eq!(parse!(FixedOffset::east(32400);
                           year: 2014, ordinal: 365, hour_div_12: 0, hour_mod_12: 4,
                           minute: 26, second: 40, nanosecond: 12_345_678, offset: 0),
                    Err(IMPOSSIBLE));
         assert_eq!(parse!(FixedOffset::east(32400);
                           year: 2014, ordinal: 365, hour_div_12: 1, hour_mod_12: 1,
                           minute: 26, second: 40, nanosecond: 12_345_678, offset: 32400),
                    Ok(FixedOffset::east(32400).ymd(2014, 12, 31)
                                               .and_hms_nano(13, 26, 40, 12_345_678)));
 
         // single result from timestamp
-        assert_eq!(parse!(Utc; timestamp: 1_420_000_000, offset: 0),
-                   Ok(Utc.ymd(2014, 12, 31).and_hms(4, 26, 40)));
-        assert_eq!(parse!(Utc; timestamp: 1_420_000_000, offset: 32400),
+        assert_eq!(parse!(UTC; timestamp: 1_420_000_000, offset: 0),
+                   Ok(UTC.ymd(2014, 12, 31).and_hms(4, 26, 40)));
+        assert_eq!(parse!(UTC; timestamp: 1_420_000_000, offset: 32400),
                    Err(IMPOSSIBLE));
         assert_eq!(parse!(FixedOffset::east(32400); timestamp: 1_420_000_000, offset: 0),
                    Err(IMPOSSIBLE));
         assert_eq!(parse!(FixedOffset::east(32400); timestamp: 1_420_000_000, offset: 32400),
                    Ok(FixedOffset::east(32400).ymd(2014, 12, 31).and_hms(13, 26, 40)));
 
         // TODO test with a variable time zone (for None and Ambiguous cases)
     }
--- a/third_party/rust/chrono/src/format/scan.rs
+++ b/third_party/rust/chrono/src/format/scan.rs
@@ -1,9 +1,10 @@
-// This is a part of Chrono.
+// This is a part of rust-chrono.
+// Copyright (c) 2015, Kang Seonghoon.
 // See README.md and LICENSE.txt for details.
 
 /*!
  * Various scanning routines for the parser.
  */
 
 use Weekday;
 use super::{ParseResult, TOO_SHORT, INVALID, OUT_OF_RANGE};
@@ -31,18 +32,17 @@ fn equals(s: &str, pattern: &str) -> boo
 pub fn number(s: &str, min: usize, max: usize) -> ParseResult<(&str, i64)> {
     assert!(min <= max);
 
     // limit `s` to given number of digits
     let mut window = s.as_bytes();
     if window.len() > max { window = &window[..max]; }
 
     // scan digits
-    let upto = window.iter().position(|&c| c < b'0' || b'9' < c)
-        .unwrap_or_else(|| window.len());
+    let upto = window.iter().position(|&c| c < b'0' || b'9' < c).unwrap_or(window.len());
     if upto < min {
         return Err(if window.is_empty() {TOO_SHORT} else {INVALID});
     }
 
     // we can overflow here, which is the only possible cause of error from `parse`.
     let v: i64 = try!(s[..upto].parse().map_err(|_| OUT_OF_RANGE));
     Ok((&s[upto..], v))
 }
@@ -61,30 +61,16 @@ pub fn nanosecond(s: &str) -> ParseResul
     let v = try!(v.checked_mul(SCALE[consumed]).ok_or(OUT_OF_RANGE));
 
     // if there are more than 9 digits, skip next digits.
     let s = s.trim_left_matches(|c: char| '0' <= c && c <= '9');
 
     Ok((s, v))
 }
 
-/// Tries to consume a fixed number of digits as a fractional second.
-/// Returns the number of whole nanoseconds (0--999,999,999).
-pub fn nanosecond_fixed(s: &str, digits: usize) -> ParseResult<(&str, i64)> {
-    // record the number of digits consumed for later scaling.
-    let (s, v) = try!(number(s, digits, digits));
-
-    // scale the number accordingly.
-    static SCALE: [i64; 10] = [0, 100_000_000, 10_000_000, 1_000_000, 100_000, 10_000,
-                               1_000, 100, 10, 1];
-    let v = try!(v.checked_mul(SCALE[digits]).ok_or(OUT_OF_RANGE));
-
-    Ok((s, v))
-}
-
 /// Tries to parse the month index (0 through 11) with the first three ASCII letters.
 pub fn short_month0(s: &str) -> ParseResult<(&str, u8)> {
     if s.len() < 3 { return Err(TOO_SHORT); }
     let buf = s.as_bytes();
     let month0 = match (buf[0] | 32, buf[1] | 32, buf[2] | 32) {
         (b'j',b'a',b'n') => 0,
         (b'f',b'e',b'b') => 1,
         (b'm',b'a',b'r') => 2,
@@ -180,25 +166,18 @@ pub fn space(s: &str) -> ParseResult<&st
 pub fn colon_or_space(s: &str) -> ParseResult<&str> {
     Ok(s.trim_left_matches(|c: char| c == ':' || c.is_whitespace()))
 }
 
 /// Tries to parse `[-+]\d\d` continued by `\d\d`. Return an offset in seconds if possible.
 ///
 /// The additional `colon` may be used to parse a mandatory or optional `:`
 /// between hours and minutes, and should return either a new suffix or `Err` when parsing fails.
-pub fn timezone_offset<F>(s: &str, consume_colon: F) -> ParseResult<(&str, i32)>
+pub fn timezone_offset<F>(mut s: &str, mut colon: F) -> ParseResult<(&str, i32)>
         where F: FnMut(&str) -> ParseResult<&str> {
-    timezone_offset_internal(s, consume_colon, false)
-}
-
-fn timezone_offset_internal<F>(mut s: &str, mut consume_colon: F, allow_missing_minutes: bool)
--> ParseResult<(&str, i32)>
-    where F: FnMut(&str) -> ParseResult<&str>
-{
     fn digits(s: &str) -> ParseResult<(u8, u8)> {
         let b = s.as_bytes();
         if b.len() < 2 {
             Err(TOO_SHORT)
         } else {
             Ok((b[0], b[1]))
         }
     }
@@ -207,98 +186,77 @@ fn timezone_offset_internal<F>(mut s: &s
         Some(&b'-') => true,
         Some(_) => return Err(INVALID),
         None => return Err(TOO_SHORT),
     };
     s = &s[1..];
 
     // hours (00--99)
     let hours = match try!(digits(s)) {
-        (h1 @ b'0'...b'9', h2 @ b'0'...b'9') => i32::from((h1 - b'0') * 10 + (h2 - b'0')),
+        (h1 @ b'0'...b'9', h2 @ b'0'...b'9') => ((h1 - b'0') * 10 + (h2 - b'0')) as i32,
         _ => return Err(INVALID),
     };
     s = &s[2..];
 
     // colons (and possibly other separators)
-    s = try!(consume_colon(s));
+    s = try!(colon(s));
 
     // minutes (00--59)
-    // if the next two items are digits then we have to add minutes
-    let minutes = if let Ok(ds) = digits(s) {
-        match ds {
-            (m1 @ b'0'...b'5', m2 @ b'0'...b'9') => i32::from((m1 - b'0') * 10 + (m2 - b'0')),
-            (b'6'...b'9', b'0'...b'9') => return Err(OUT_OF_RANGE),
-            _ => return Err(INVALID),
-        }
-    } else if allow_missing_minutes {
-        0
-    } else {
-        return Err(TOO_SHORT);
+    let minutes = match try!(digits(s)) {
+        (m1 @ b'0'...b'5', m2 @ b'0'...b'9') => ((m1 - b'0') * 10 + (m2 - b'0')) as i32,
+        (b'6'...b'9', b'0'...b'9') => return Err(OUT_OF_RANGE),
+        _ => return Err(INVALID),
     };
-    s = match s.len() {
-        len if len >= 2 => &s[2..],
-        len if len == 0 => s,
-        _ => return Err(TOO_SHORT),
-    };
+    s = &s[2..];
 
     let seconds = hours * 3600 + minutes * 60;
     Ok((s, if negative {-seconds} else {seconds}))
 }
 
 /// Same to `timezone_offset` but also allows for `z`/`Z` which is same to `+00:00`.
-pub fn timezone_offset_zulu<F>(s: &str, colon: F)
--> ParseResult<(&str, i32)>
-    where F: FnMut(&str) -> ParseResult<&str>
-{
+pub fn timezone_offset_zulu<F>(s: &str, colon: F) -> ParseResult<(&str, i32)>
+        where F: FnMut(&str) -> ParseResult<&str> {
     match s.as_bytes().first() {
         Some(&b'z') | Some(&b'Z') => Ok((&s[1..], 0)),
         _ => timezone_offset(s, colon),
     }
 }
 
-/// Same to `timezone_offset` but also allows for `z`/`Z` which is same to
-/// `+00:00`, and allows missing minutes entirely.
-pub fn timezone_offset_permissive<F>(s: &str, colon: F)
--> ParseResult<(&str, i32)>
-    where F: FnMut(&str) -> ParseResult<&str>
-{
-    match s.as_bytes().first() {
-        Some(&b'z') | Some(&b'Z') => Ok((&s[1..], 0)),
-        _ => timezone_offset_internal(s, colon, true),
-    }
-}
-
 /// Same to `timezone_offset` but also allows for RFC 2822 legacy timezones.
 /// May return `None` which indicates an insufficient offset data (i.e. `-0000`).
 pub fn timezone_offset_2822(s: &str) -> ParseResult<(&str, Option<i32>)> {
     // tries to parse legacy time zone names
     let upto = s.as_bytes().iter().position(|&c| match c { b'a'...b'z' | b'A'...b'Z' => false,
-                                                           _ => true })
-        .unwrap_or_else(|| s.len());
+                                                           _ => true }).unwrap_or(s.len());
     if upto > 0 {
         let name = &s[..upto];
         let s = &s[upto..];
-        let offset_hours = |o| Ok((s, Some(o * 3600)));
         if equals(name, "gmt") || equals(name, "ut") {
-            offset_hours(0)
+            Ok((s, Some(0)))
+        } else if equals(name, "est") {
+            Ok((s, Some(-5 * 3600)))
         } else if equals(name, "edt") {
-            offset_hours(-4)
-        } else if equals(name, "est") || equals(name, "cdt") {
-            offset_hours(-5)
-        } else if equals(name, "cst") || equals(name, "mdt") {
-            offset_hours(-6)
-        } else if equals(name, "mst") || equals(name, "pdt") {
-            offset_hours(-7)
+            Ok((s, Some(-4 * 3600)))
+        } else if equals(name, "cst") {
+            Ok((s, Some(-6 * 3600)))
+        } else if equals(name, "cdt") {
+            Ok((s, Some(-5 * 3600)))
+        } else if equals(name, "mst") {
+            Ok((s, Some(-7 * 3600)))
+        } else if equals(name, "mdt") {
+            Ok((s, Some(-6 * 3600)))
         } else if equals(name, "pst") {
-            offset_hours(-8)
+            Ok((s, Some(-8 * 3600)))
+        } else if equals(name, "pdt") {
+            Ok((s, Some(-7 * 3600)))
         } else {
             Ok((s, None)) // recommended by RFC 2822: consume but treat it as -0000
         }
     } else {
         let (s_, offset) = try!(timezone_offset(s, |s| Ok(s)));
-        if offset == 0 && s.starts_with('-') { // -0000 is not same to +0000
+        if offset == 0 && s.starts_with("-") { // -0000 is not same to +0000
             Ok((s_, None))
         } else {
             Ok((s_, Some(offset)))
         }
     }
 }
 
--- a/third_party/rust/chrono/src/format/strftime.rs
+++ b/third_party/rust/chrono/src/format/strftime.rs
@@ -1,93 +1,90 @@
-// This is a part of Chrono.
+// This is a part of rust-chrono.
+// Copyright (c) 2015, Kang Seonghoon.
 // See README.md and LICENSE.txt for details.
 
 /*!
 `strftime`/`strptime`-inspired date and time formatting syntax.
 
 ## Specifiers
 
 The following specifiers are available both to formatting and parsing.
 
-| Spec. | Example  | Description                                                                |
-|-------|----------|----------------------------------------------------------------------------|
-|       |          | **DATE SPECIFIERS:**                                                       |
-| `%Y`  | `2001`   | The full proleptic Gregorian year, zero-padded to 4 digits. [1]            |
-| `%C`  | `20`     | The proleptic Gregorian year divided by 100, zero-padded to 2 digits. [2]  |
-| `%y`  | `01`     | The proleptic Gregorian year modulo 100, zero-padded to 2 digits. [2]      |
-|       |          |                                                                            |
-| `%m`  | `07`     | Month number (01--12), zero-padded to 2 digits.                            |
-| `%b`  | `Jul`    | Abbreviated month name. Always 3 letters.                                  |
-| `%B`  | `July`   | Full month name. Also accepts corresponding abbreviation in parsing.       |
-| `%h`  | `Jul`    | Same to `%b`.                                                              |
-|       |          |                                                                            |
-| `%d`  | `08`     | Day number (01--31), zero-padded to 2 digits.                              |
-| `%e`  | ` 8`     | Same to `%d` but space-padded. Same to `%_d`.                              |
-|       |          |                                                                            |
-| `%a`  | `Sun`    | Abbreviated weekday name. Always 3 letters.                                |
-| `%A`  | `Sunday` | Full weekday name. Also accepts corresponding abbreviation in parsing.     |
-| `%w`  | `0`      | Sunday = 0, Monday = 1, ..., Saturday = 6.                                 |
-| `%u`  | `7`      | Monday = 1, Tuesday = 2, ..., Sunday = 7. (ISO 8601)                       |
-|       |          |                                                                            |
-| `%U`  | `28`     | Week number starting with Sunday (00--53), zero-padded to 2 digits. [3]    |
-| `%W`  | `27`     | Same to `%U`, but week 1 starts with the first Monday in that year instead.|
-|       |          |                                                                            |
-| `%G`  | `2001`   | Same to `%Y` but uses the year number in ISO 8601 week date. [4]           |
-| `%g`  | `01`     | Same to `%y` but uses the year number in ISO 8601 week date. [4]           |
-| `%V`  | `27`     | Same to `%U` but uses the week number in ISO 8601 week date (01--53). [4]  |
-|       |          |                                                                            |
-| `%j`  | `189`    | Day of the year (001--366), zero-padded to 3 digits.                       |
-|       |          |                                                                            |
-| `%D`  | `07/08/01`    | Month-day-year format. Same to `%m/%d/%y`.                            |
-| `%x`  | `07/08/01`    | Same to `%D`.                                                         |
-| `%F`  | `2001-07-08`  | Year-month-day format (ISO 8601). Same to `%Y-%m-%d`.                 |
-| `%v`  | ` 8-Jul-2001` | Day-month-year format. Same to `%e-%b-%Y`.                            |
-|       |          |                                                                            |
-|       |          | **TIME SPECIFIERS:**                                                       |
-| `%H`  | `00`     | Hour number (00--23), zero-padded to 2 digits.                             |
-| `%k`  | ` 0`     | Same to `%H` but space-padded. Same to `%_H`.                              |
-| `%I`  | `12`     | Hour number in 12-hour clocks (01--12), zero-padded to 2 digits.           |
-| `%l`  | `12`     | Same to `%I` but space-padded. Same to `%_I`.                              |
-|       |          |                                                                            |
-| `%P`  | `am`     | `am` or `pm` in 12-hour clocks.                                            |
-| `%p`  | `AM`     | `AM` or `PM` in 12-hour clocks.                                            |
-|       |          |                                                                            |
-| `%M`  | `34`     | Minute number (00--59), zero-padded to 2 digits.                           |
-| `%S`  | `60`     | Second number (00--60), zero-padded to 2 digits. [5]                       |
-| `%f`  | `026490000`   | The fractional seconds (in nanoseconds) since last whole second. [8]  |
-| `%.f` | `.026490`| Similar to `.%f` but left-aligned. These all consume the leading dot. [8]  |
-| `%.3f`| `.026`        | Similar to `.%f` but left-aligned but fixed to a length of 3. [8]     |
-| `%.6f`| `.026490`     | Similar to `.%f` but left-aligned but fixed to a length of 6. [8]     |
-| `%.9f`| `.026490000`  | Similar to `.%f` but left-aligned but fixed to a length of 9. [8]     |
-| `%3f` | `026`         | Similar to `%.3f` but without the leading dot. [8]                    |
-| `%6f` | `026490`      | Similar to `%.6f` but without the leading dot. [8]                    |
-| `%9f` | `026490000`   | Similar to `%.9f` but without the leading dot. [8]                    |
-|       |               |                                                                       |
-| `%R`  | `00:34`       | Hour-minute format. Same to `%H:%M`.                                  |
-| `%T`  | `00:34:60`    | Hour-minute-second format. Same to `%H:%M:%S`.                        |
-| `%X`  | `00:34:60`    | Same to `%T`.                                                         |
-| `%r`  | `12:34:60 AM` | Hour-minute-second format in 12-hour clocks. Same to `%I:%M:%S %p`.   |
-|       |          |                                                                            |
-|       |          | **TIME ZONE SPECIFIERS:**                                                  |
-| `%Z`  | `ACST`   | *Formatting only:* Local time zone name.                                   |
-| `%z`  | `+0930`  | Offset from the local time to UTC (with UTC being `+0000`).                |
-| `%:z` | `+09:30` | Same to `%z` but with a colon.                                             |
-| `%#z` | `+09`    | *Parsing only:* Same to `%z` but allows minutes to be missing or present.  |
-|       |          |                                                                            |
-|       |          | **DATE & TIME SPECIFIERS:**                                                |
-|`%c`|`Sun Jul  8 00:34:60 2001`|`ctime` date & time format. Same to `%a %b %e %T %Y` sans `\n`.|
-| `%+`  | `2001-07-08T00:34:60.026490+09:30` | ISO 8601 / RFC 3339 date & time format. [6]      |
-|       |               |                                                                       |
-| `%s`  | `994518299`   | UNIX timestamp, the number of seconds since 1970-01-01 00:00 UTC. [7] |
-|       |          |                                                                            |
-|       |          | **SPECIAL SPECIFIERS:**                                                    |
-| `%t`  |          | Literal tab (`\t`).                                                        |
-| `%n`  |          | Literal newline (`\n`).                                                    |
-| `%%`  |          | Literal percent sign.                                                      |
+Spec. | Example       | Description
+----- | ------------- | -----------
+      |               | **DATE SPECIFIERS:**
+`%Y`  | `2001`        | The full proleptic Gregorian year, zero-padded to 4 digits. [1]
+`%C`  | `20`          | The proleptic Gregorian year divided by 100, zero-padded to 2 digits. [2]
+`%y`  | `01`          | The proleptic Gregorian year modulo 100, zero-padded to 2 digits. [2]
+      |               |
+`%m`  | `07`          | Month number (01--12), zero-padded to 2 digits.
+`%b`  | `Jul`         | Abbreviated month name. Always 3 letters.
+`%B`  | `July`        | Full month name. Also accepts corresponding abbreviation in parsing.
+`%h`  | `Jul`         | Same to `%b`.
+      |               |
+`%d`  | `08`          | Day number (01--31), zero-padded to 2 digits.
+`%e`  | ` 8`          | Same to `%d` but space-padded. Same to `%_d`.
+      |               |
+`%a`  | `Sun`         | Abbreviated weekday name. Always 3 letters.
+`%A`  | `Sunday`      | Full weekday name. Also accepts corresponding abbreviation in parsing.
+`%w`  | `0`           | Sunday = 0, Monday = 1, ..., Saturday = 6.
+`%u`  | `7`           | Monday = 1, Tuesday = 2, ..., Sunday = 7. (ISO 8601)
+      |               |
+`%U`  | `28`          | Week number starting with Sunday (00--53), zero-padded to 2 digits. [3]
+`%W`  | `27`          | Same to `%U`, but week 1 starts with the first Monday in that year instead.
+      |               |
+`%G`  | `2001`        | Same to `%Y` but uses the year number in ISO 8601 week date. [4]
+`%g`  | `01`          | Same to `%y` but uses the year number in ISO 8601 week date. [4]
+`%V`  | `27`          | Same to `%U` but uses the week number in ISO 8601 week date (01--53). [4]
+      |               |
+`%j`  | `189`         | Day of the year (001--366), zero-padded to 3 digits.
+      |               |
+`%D`  | `07/08/01`    | Month-day-year format. Same to `%m/%d/%y`.
+`%x`  | `07/08/01`    | Same to `%D`.
+`%F`  | `2001-07-08`  | Year-month-day format (ISO 8601). Same to `%Y-%m-%d`.
+`%v`  | ` 8-Jul-2001` | Day-month-year format. Same to `%e-%b-%Y`.
+      |               |
+      |               | **TIME SPECIFIERS:**
+`%H`  | `00`          | Hour number (00--23), zero-padded to 2 digits.
+`%k`  | ` 0`          | Same to `%H` but space-padded. Same to `%_H`.
+`%I`  | `12`          | Hour number in 12-hour clocks (01--12), zero-padded to 2 digits.
+`%l`  | `12`          | Same to `%I` but space-padded. Same to `%_I`.
+      |               |
+`%P`  | `am`          | `am` or `pm` in 12-hour clocks.
+`%p`  | `AM`          | `AM` or `PM` in 12-hour clocks.
+      |               |
+`%M`  | `34`          | Minute number (00--59), zero-padded to 2 digits.
+`%S`  | `60`          | Second number (00--60), zero-padded to 2 digits. [5]
+`%f`  | `026490000`   | The fractional seconds (in nanoseconds) since last whole second. [8]
+`%.f` | `.026490`     | Similar to `.%f` but left-aligned. [8]
+`%.3f`| `.026`        | Similar to `.%f` but left-aligned but fixed to a length of 3. [8]
+`%.6f`| `.026490`     | Similar to `.%f` but left-aligned but fixed to a length of 6. [8]
+`%.9f`| `.026490000`  | Similar to `.%f` but left-aligned but fixed to a length of 9. [8]
+      |               |
+`%R`  | `00:34`       | Hour-minute format. Same to `%H:%M`.
+`%T`  | `00:34:60`    | Hour-minute-second format. Same to `%H:%M:%S`.
+`%X`  | `00:34:60`    | Same to `%T`.
+`%r`  | `12:34:60 AM` | Hour-minute-second format in 12-hour clocks. Same to `%I:%M:%S %p`.
+      |               |
+      |               | **TIME ZONE SPECIFIERS:**
+`%Z`  | `ACST`        | *Formatting only:* Local time zone name.
+`%z`  | `+0930`       | Offset from the local time to UTC (with UTC being `+0000`).
+`%:z` | `+09:30`      | Same to `%z` but with a colon.
+      |               |
+      |               | **DATE & TIME SPECIFIERS:**
+`%c`  | `Sun Jul  8 00:34:60 2001` | `ctime` date & time format. Same to `%a %b %e %T %Y` sans `\n`.
+`%+`  | `2001-07-08T00:34:60.026490+09:30` | ISO 8601 / RFC 3339 date & time format. [6]
+      |               |
+`%s`  | `994518299`   | UNIX timestamp, the number of seconds since 1970-01-01 00:00 UTC. [7]
+      |               |
+      |               | **SPECIAL SPECIFIERS:**
+`%t`  |               | Literal tab (`\t`).
+`%n`  |               | Literal newline (`\n`).
+`%%`  |               | Literal percent sign.
 
 It is possible to override the default padding behavior of numeric specifiers `%?`.
 This is not allowed for other specifiers and will result in the `BAD_FORMAT` error.
 
 Modifier | Description
 -------- | -----------
 `%-?`    | Suppresses any padding including spaces and zeroes. (e.g. `%j` = `012`, `%-j` = `12`)
 `%_?`    | Uses spaces as a padding. (e.g. `%j` = `012`, `%_j` = ` 12`)
@@ -121,17 +118,17 @@ 6. `%+`:
    While Chrono's format for `%+` is far more stable,
    it is best to avoid this specifier if you want to control the exact output.
 
 7. `%s`:
    This is not padded and can be negative.
    For the purpose of Chrono, it only accounts for non-leap seconds
    so it slightly differs from ISO C `strftime` behavior.
 
-8. `%f`, `%.f`, `%.3f`, `%.6f`, `%.9f`, `%3f`, `%6f`, `%9f`:
+8. `%f`, `%.f`, `%.3f`, `%.6f`, `%.9f`:
 
    The default `%f` is right-aligned and always zero-padded to 9 digits
    for the compatibility with glibc and others,
    so it always counts the number of nanoseconds since the last whole second.
    E.g. 7ms after the last second will print `007000000`,
    and parsing `7000000` will yield the same.
 
    The variant `%.f` is left-aligned and print 0, 3, 6 or 9 fractional digits
@@ -143,28 +140,22 @@ 8. `%f`, `%.f`, `%.3f`, `%.6f`, `%.9f`, 
 
    The variant `%.3f`, `%.6f` and `%.9f` are left-aligned and print 3, 6 or 9 fractional digits
    according to the number preceding `f`.
    E.g. 70ms after the last second under `%.3f` will print `.070` (note: not `.07`),
    and parsing `.07`, `.070000` etc. will yield the same.
    Note that they can read nothing if the fractional part is zero or
    the next character is not `.` however will print with the specified length.
 
-   The variant `%3f`, `%6f` and `%9f` are left-aligned and print 3, 6 or 9 fractional digits
-   according to the number preceding `f`, but without the leading dot.
-   E.g. 70ms after the last second under `%3f` will print `070` (note: not `07`),
-   and parsing `07`, `070000` etc. will yield the same.
-   Note that they can read nothing if the fractional part is zero.
-
 */
 
-use super::{Item, Numeric, Fixed, InternalFixed, InternalInternal, Pad};
+use super::{Item, Numeric, Fixed, Pad};
 
 /// Parsing iterator for `strftime`-like format strings.
-#[derive(Clone, Debug)]
+#[derive(Clone)]
 pub struct StrftimeItems<'a> {
     /// Remaining portion of the string.
     remainder: &'a str,
     /// If the current specifier is composed of multiple formatting items (e.g. `%+`),
     /// parser refers to the statically reconstructed slice of them.
     /// If `recons` is not empty they have to be returned earlier than the `remainder`.
     recons: &'static [Item<'static>],
 }
@@ -172,32 +163,30 @@ pub struct StrftimeItems<'a> {
 impl<'a> StrftimeItems<'a> {
     /// Creates a new parsing iterator from the `strftime`-like format string.
     pub fn new(s: &'a str) -> StrftimeItems<'a> {
         static FMT_NONE: [Item<'static>; 0] = [];
         StrftimeItems { remainder: s, recons: &FMT_NONE }
     }
 }
 
-const HAVE_ALTERNATES: &'static str = "z";
-
 impl<'a> Iterator for StrftimeItems<'a> {
     type Item = Item<'a>;
 
     fn next(&mut self) -> Option<Item<'a>> {
         // we have some reconstructed items to return
         if !self.recons.is_empty() {
-            let item = self.recons[0].clone();
+            let item = self.recons[0];
             self.recons = &self.recons[1..];
             return Some(item);
         }
 
         match self.remainder.chars().next() {
             // we are done
-            None => None,
+            None => return None,
 
             // the next item is a specifier
             Some('%') => {
                 self.remainder = &self.remainder[1..];
 
                 macro_rules! next {
                     () => (
                         match self.remainder.chars().next() {
@@ -212,21 +201,17 @@ impl<'a> Iterator for StrftimeItems<'a> 
 
                 let spec = next!();
                 let pad_override = match spec {
                     '-' => Some(Pad::None),
                     '0' => Some(Pad::Zero),
                     '_' => Some(Pad::Space),
                     _ => None,
                 };
-                let is_alternate = spec == '#';
-                let spec = if pad_override.is_some() || is_alternate { next!() } else { spec };
-                if is_alternate && !HAVE_ALTERNATES.contains(spec) {
-                    return Some(Item::Error);
-                }
+                let spec = if pad_override.is_some() { next!() } else { spec };
 
                 macro_rules! recons {
                     [$head:expr, $($tail:expr),+] => ({
                         const RECONS: &'static [Item<'static>] = &[$($tail),+];
                         self.recons = RECONS;
                         $head
                     })
                 }
@@ -248,24 +233,25 @@ impl<'a> Iterator for StrftimeItems<'a> 
                     'T' => recons![num0!(Hour), lit!(":"), num0!(Minute), lit!(":"), num0!(Second)],
                     'U' => num0!(WeekFromSun),
                     'V' => num0!(IsoWeek),
                     'W' => num0!(WeekFromMon),
                     'X' => recons![num0!(Hour), lit!(":"), num0!(Minute), lit!(":"), num0!(Second)],
                     'Y' => num0!(Year),
                     'Z' => fix!(TimezoneName),
                     'a' => fix!(ShortWeekdayName),
-                    'b' | 'h' => fix!(ShortMonthName),
+                    'b' => fix!(ShortMonthName),
                     'c' => recons![fix!(ShortWeekdayName), sp!(" "), fix!(ShortMonthName),
                                    sp!(" "), nums!(Day), sp!(" "), num0!(Hour), lit!(":"),
                                    num0!(Minute), lit!(":"), num0!(Second), sp!(" "), num0!(Year)],
                     'd' => num0!(Day),
                     'e' => nums!(Day),
                     'f' => num0!(Nanosecond),
                     'g' => num0!(IsoYearMod100),
+                    'h' => fix!(ShortMonthName),
                     'j' => num0!(Ordinal),
                     'k' => nums!(Hour),
                     'l' => nums!(Hour12),
                     'm' => num0!(Month),
                     'n' => sp!("\n"),
                     'p' => fix!(UpperAmPm),
                     'r' => recons![num0!(Hour12), lit!(":"), num0!(Minute), lit!(":"),
                                    num0!(Second), sp!(" "), fix!(UpperAmPm)],
@@ -273,21 +259,17 @@ impl<'a> Iterator for StrftimeItems<'a> 
                     't' => sp!("\t"),
                     'u' => num!(WeekdayFromMon),
                     'v' => recons![nums!(Day), lit!("-"), fix!(ShortMonthName), lit!("-"),
                                    num0!(Year)],
                     'w' => num!(NumDaysFromSun),
                     'x' => recons![num0!(Month), lit!("/"), num0!(Day), lit!("/"),
                                    num0!(YearMod100)],
                     'y' => num0!(YearMod100),
-                    'z' => if is_alternate {
-                        internal_fix!(TimezoneOffsetPermissive)
-                    } else {
-                        fix!(TimezoneOffset)
-                    },
+                    'z' => fix!(TimezoneOffset),
                     '+' => fix!(RFC3339),
                     ':' => match next!() {
                         'z' => fix!(TimezoneOffsetColon),
                         _ => Item::Error,
                     },
                     '.' => match next!() {
                         '3' => match next!() {
                             'f' => fix!(Nanosecond3),
@@ -299,59 +281,47 @@ impl<'a> Iterator for StrftimeItems<'a> 
                         },
                         '9' => match next!() {
                             'f' => fix!(Nanosecond9),
                             _ => Item::Error,
                         },
                         'f' => fix!(Nanosecond),
                         _ => Item::Error,
                     },
-                    '3' => match next!() {
-                        'f' => internal_fix!(Nanosecond3NoDot),
-                        _ => Item::Error,
-                    },
-                    '6' => match next!() {
-                        'f' => internal_fix!(Nanosecond6NoDot),
-                        _ => Item::Error,
-                    },
-                    '9' => match next!() {
-                        'f' => internal_fix!(Nanosecond9NoDot),
-                        _ => Item::Error,
-                    },
                     '%' => lit!("%"),
                     _ => Item::Error, // no such specifier
                 };
 
                 // adjust `item` if we have any padding modifier
                 if let Some(new_pad) = pad_override {
                     match item {
-                        Item::Numeric(ref kind, _pad) if self.recons.is_empty() =>
-                            Some(Item::Numeric(kind.clone(), new_pad)),
+                        Item::Numeric(kind, _pad) if self.recons.is_empty() =>
+                            Some(Item::Numeric(kind, new_pad)),
                         _ => Some(Item::Error), // no reconstructed or non-numeric item allowed
                     }
                 } else {
                     Some(item)
                 }
             },
 
             // the next item is space
             Some(c) if c.is_whitespace() => {
                 // `%` is not a whitespace, so `c != '%'` is redundant
                 let nextspec = self.remainder.find(|c: char| !c.is_whitespace())
-                                             .unwrap_or_else(|| self.remainder.len());
+                                             .unwrap_or(self.remainder.len());
                 assert!(nextspec > 0);
                 let item = sp!(&self.remainder[..nextspec]);
                 self.remainder = &self.remainder[nextspec..];
                 Some(item)
             },
 
             // the next item is literal
             _ => {
                 let nextspec = self.remainder.find(|c: char| c.is_whitespace() || c == '%')
-                                             .unwrap_or_else(|| self.remainder.len());
+                                             .unwrap_or(self.remainder.len());
                 assert!(nextspec > 0);
                 let item = lit!(&self.remainder[..nextspec]);
                 self.remainder = &self.remainder[nextspec..];
                 Some(item)
             },
         }
     }
 }
@@ -395,27 +365,24 @@ fn test_strftime_items() {
     assert_eq!(parse_and_collect("%-j"), [num!(Ordinal)]);
     assert_eq!(parse_and_collect("%0j"), [num0!(Ordinal)]);
     assert_eq!(parse_and_collect("%_j"), [nums!(Ordinal)]);
     assert_eq!(parse_and_collect("%.e"), [Item::Error]);
     assert_eq!(parse_and_collect("%:e"), [Item::Error]);
     assert_eq!(parse_and_collect("%-e"), [num!(Day)]);
     assert_eq!(parse_and_collect("%0e"), [num0!(Day)]);
     assert_eq!(parse_and_collect("%_e"), [nums!(Day)]);
-    assert_eq!(parse_and_collect("%z"), [fix!(TimezoneOffset)]);
-    assert_eq!(parse_and_collect("%#z"), [internal_fix!(TimezoneOffsetPermissive)]);
-    assert_eq!(parse_and_collect("%#m"), [Item::Error]);
 }
 
 #[cfg(test)]
 #[test]
 fn test_strftime_docs() {
-    use {FixedOffset, TimeZone, Timelike};
+    use {FixedOffset, TimeZone};
 
-    let dt = FixedOffset::east(34200).ymd(2001, 7, 8).and_hms_nano(0, 34, 59, 1_026_490_708);
+    let dt = FixedOffset::east(34200).ymd(2001, 7, 8).and_hms_nano(0, 34, 59, 1_026_490_000);
 
     // date specifiers
     assert_eq!(dt.format("%Y").to_string(), "2001");
     assert_eq!(dt.format("%C").to_string(), "20");
     assert_eq!(dt.format("%y").to_string(), "01");
     assert_eq!(dt.format("%m").to_string(), "07");
     assert_eq!(dt.format("%b").to_string(), "Jul");
     assert_eq!(dt.format("%B").to_string(), "July");
@@ -444,40 +411,33 @@ fn test_strftime_docs() {
     assert_eq!(dt.format("%k").to_string(), dt.format("%_H").to_string());
     assert_eq!(dt.format("%I").to_string(), "12");
     assert_eq!(dt.format("%l").to_string(), "12");
     assert_eq!(dt.format("%l").to_string(), dt.format("%_I").to_string());
     assert_eq!(dt.format("%P").to_string(), "am");
     assert_eq!(dt.format("%p").to_string(), "AM");
     assert_eq!(dt.format("%M").to_string(), "34");
     assert_eq!(dt.format("%S").to_string(), "60");
-    assert_eq!(dt.format("%f").to_string(), "026490708");
-    assert_eq!(dt.format("%.f").to_string(), ".026490708");
-    assert_eq!(dt.with_nanosecond(1_026_490_000).unwrap().format("%.f").to_string(),
-               ".026490");
+    assert_eq!(dt.format("%f").to_string(), "026490000");
+    assert_eq!(dt.format("%.f").to_string(), ".026490");
     assert_eq!(dt.format("%.3f").to_string(), ".026");
     assert_eq!(dt.format("%.6f").to_string(), ".026490");
-    assert_eq!(dt.format("%.9f").to_string(), ".026490708");
-    assert_eq!(dt.format("%3f").to_string(), "026");
-    assert_eq!(dt.format("%6f").to_string(), "026490");
-    assert_eq!(dt.format("%9f").to_string(), "026490708");
+    assert_eq!(dt.format("%.9f").to_string(), ".026490000");
     assert_eq!(dt.format("%R").to_string(), "00:34");
     assert_eq!(dt.format("%T").to_string(), "00:34:60");
     assert_eq!(dt.format("%X").to_string(), "00:34:60");
     assert_eq!(dt.format("%r").to_string(), "12:34:60 AM");
 
     // time zone specifiers
     //assert_eq!(dt.format("%Z").to_string(), "ACST");
     assert_eq!(dt.format("%z").to_string(), "+0930");
     assert_eq!(dt.format("%:z").to_string(), "+09:30");
 
     // date & time specifiers
     assert_eq!(dt.format("%c").to_string(), "Sun Jul  8 00:34:60 2001");
-    assert_eq!(dt.format("%+").to_string(), "2001-07-08T00:34:60.026490708+09:30");
-    assert_eq!(dt.with_nanosecond(1_026_490_000).unwrap().format("%+").to_string(),
-               "2001-07-08T00:34:60.026490+09:30");
+    assert_eq!(dt.format("%+").to_string(), "2001-07-08T00:34:60.026490+09:30");
     assert_eq!(dt.format("%s").to_string(), "994518299");
 
     // special specifiers
     assert_eq!(dt.format("%t").to_string(), "\t");
     assert_eq!(dt.format("%n").to_string(), "\n");
     assert_eq!(dt.format("%%").to_string(), "%");
 }
--- a/third_party/rust/chrono/src/lib.rs
+++ b/third_party/rust/chrono/src/lib.rs
@@ -1,171 +1,149 @@
-// This is a part of Chrono.
+// This is a part of rust-chrono.
+// Copyright (c) 2014-2015, Kang Seonghoon.
 // See README.md and LICENSE.txt for details.
 
-//! # Chrono: Date and Time for Rust
+//! # Chrono 0.2.25
 //!
+//! Date and time handling for Rust. (also known as `rust-chrono`)
 //! It aims to be a feature-complete superset of
 //! the [time](https://github.com/rust-lang-deprecated/time) library.
 //! In particular,
 //!
 //! * Chrono strictly adheres to ISO 8601.
 //! * Chrono is timezone-aware by default, with separate timezone-naive types.
 //! * Chrono is space-optimal and (while not being the primary goal) reasonably efficient.
 //!
 //! There were several previous attempts to bring a good date and time library to Rust,
-//! which Chrono builds upon and should acknowledge:
+//! which Chrono builts upon and should acknowledge:
 //!
 //! * [Initial research on
 //!    the wiki](https://github.com/rust-lang/rust-wiki-backup/blob/master/Lib-datetime.md)
 //! * Dietrich Epp's [datetime-rs](https://github.com/depp/datetime-rs)
 //! * Luis de Bethencourt's [rust-datetime](https://github.com/luisbg/rust-datetime)
 //!
-//! Any significant changes to Chrono are documented in
-//! the [`CHANGELOG.md`](https://github.com/chronotope/chrono/blob/master/CHANGELOG.md) file.
-//!
 //! ## Usage
 //!
 //! Put this in your `Cargo.toml`:
 //!
 //! ```toml
 //! [dependencies]
-//! chrono = "0.4"
+//! chrono = "0.2"
 //! ```
 //!
-//! Or, if you want [Serde](https://github.com/serde-rs/serde) include the
-//! feature like this:
+//! Or, if you want [Serde](https://github.com/serde-rs/serde) or
+//! [rustc-serialize](https://github.com/rust-lang-nursery/rustc-serialize) support,
+//! include the features like this:
 //!
 //! ```toml
 //! [dependencies]
-//! chrono = { version = "0.4", features = ["serde"] }
+//! chrono = { version = "0.2", features = ["serde", "rustc-serialize"] }
 //! ```
 //!
 //! Then put this in your crate root:
 //!
 //! ```rust
 //! extern crate chrono;
 //! ```
 //!
-//! Avoid using `use chrono::*;` as Chrono exports several modules other than types.
-//! If you prefer the glob imports, use the following instead:
-//!
-//! ```rust
-//! use chrono::prelude::*;
-//! ```
-//!
 //! ## Overview
 //!
 //! ### Duration
 //!
-//! Chrono currently uses
-//! the [`time::Duration`](https://docs.rs/time/0.1.40/time/struct.Duration.html) type
-//! from the `time` crate to represent the magnitude of a time span.
-//! Since this has the same name to the newer, standard type for duration,
-//! the reference will refer this type as `OldDuration`.
-//! Note that this is an "accurate" duration represented as seconds and
-//! nanoseconds and does not represent "nominal" components such as days or
-//! months.
-//!
-//! Chrono does not yet natively support
-//! the standard [`Duration`](https://docs.rs/time/0.1.40/time/struct.Duration.html) type,
-//! but it will be supported in the future.
-//! Meanwhile you can convert between two types with
-//! [`Duration::from_std`](https://docs.rs/time/0.1.40/time/struct.Duration.html#method.from_std)
-//! and
-//! [`Duration::to_std`](https://docs.rs/time/0.1.40/time/struct.Duration.html#method.to_std)
-//! methods.
+//! [**`Duration`**](./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.
 //!
 //! ### Date and Time
 //!
 //! Chrono provides a
-//! [**`DateTime`**](./struct.DateTime.html)
+//! [**`DateTime`**](./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
 //! that is unconcerned with timezones, consider
 //! [`time::SystemTime`](https://doc.rust-lang.org/std/time/struct.SystemTime.html),
 //! which tracks your system clock, or
 //! [`time::Instant`](https://doc.rust-lang.org/std/time/struct.Instant.html), which
 //! is an opaque but monotonically-increasing representation of a moment in time.
 //!
 //! `DateTime` is timezone-aware and must be constructed from
 //! the [**`TimeZone`**](./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`**](./offset/struct.Utc.html) specifies the UTC time zone. It is most efficient.
+//! * [**`UTC`**](./offset/utc/struct.UTC.html) specifies the UTC time zone. It is most efficient.
 //!
-//! * [**`Local`**](./offset/struct.Local.html) specifies the system local time zone.
+//! * [**`Local`**](./offset/local/struct.Local.html) specifies the system local time zone.
 //!
-//! * [**`FixedOffset`**](./offset/struct.FixedOffset.html) specifies
+//! * [**`FixedOffset`**](./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,
 //!   you would want to normalize other `TimeZone`s into this type.
 //!
 //! `DateTime`s with different `TimeZone` types are distinct and do not mix,
 //! but can be converted to each other using
-//! the [`DateTime::with_timezone`](./struct.DateTime.html#method.with_timezone) method.
+//! the [`DateTime::with_timezone`](./datetime/struct.DateTime.html#method.with_timezone) method.
 //!
 //! You can get the current date and time in the UTC time zone
-//! ([`Utc::now()`](./offset/struct.Utc.html#method.now))
+//! ([`UTC::now()`](./offset/utc/struct.UTC.html#method.now))
 //! or in the local time zone
-//! ([`Local::now()`](./offset/struct.Local.html#method.now)).
+//! ([`Local::now()`](./offset/local/struct.Local.html#method.now)).
 //!
-//! ```rust
-//! use chrono::prelude::*;
+//! ~~~~ {.rust}
+//! use chrono::*;
 //!
-//! let utc: DateTime<Utc> = Utc::now();       // e.g. `2014-11-28T12:45:59.324310806Z`
+//! let utc: DateTime<UTC> = UTC::now();       // e.g. `2014-11-28T12:45:59.324310806Z`
 //! let local: DateTime<Local> = Local::now(); // e.g. `2014-11-28T21:45:59.324310806+09:00`
 //! # let _ = utc; let _ = local;
-//! ```
+//! ~~~~
 //!
 //! Alternatively, you can create your own date and time.
 //! This is a bit verbose due to Rust's lack of function and method overloading,
 //! but in turn we get a rich combination of initialization methods.
 //!
-//! ```rust
-//! use chrono::prelude::*;
-//! use chrono::offset::LocalResult;
+//! ~~~~ {.rust}
+//! use chrono::*;
 //!
-//! let dt = Utc.ymd(2014, 7, 8).and_hms(9, 10, 11); // `2014-07-08T09:10:11Z`
+//! let dt = UTC.ymd(2014, 7, 8).and_hms(9, 10, 11); // `2014-07-08T09:10:11Z`
 //! // July 8 is 188th day of the year 2014 (`o` for "ordinal")
-//! assert_eq!(dt, Utc.yo(2014, 189).and_hms(9, 10, 11));
+//! assert_eq!(dt, UTC.yo(2014, 189).and_hms(9, 10, 11));
 //! // July 8 is Tuesday in ISO week 28 of the year 2014.
-//! assert_eq!(dt, Utc.isoywd(2014, 28, Weekday::Tue).and_hms(9, 10, 11));
+//! assert_eq!(dt, UTC.isoywd(2014, 28, Weekday::Tue).and_hms(9, 10, 11));
 //!
-//! let dt = Utc.ymd(2014, 7, 8).and_hms_milli(9, 10, 11, 12); // `2014-07-08T09:10:11.012Z`
-//! assert_eq!(dt, Utc.ymd(2014, 7, 8).and_hms_micro(9, 10, 11, 12_000));
-//! assert_eq!(dt, Utc.ymd(2014, 7, 8).and_hms_nano(9, 10, 11, 12_000_000));
+//! let dt = UTC.ymd(2014, 7, 8).and_hms_milli(9, 10, 11, 12); // `2014-07-08T09:10:11.012Z`
+//! assert_eq!(dt, UTC.ymd(2014, 7, 8).and_hms_micro(9, 10, 11, 12_000));
+//! assert_eq!(dt, UTC.ymd(2014, 7, 8).and_hms_nano(9, 10, 11, 12_000_000));
 //!
 //! // dynamic verification
-//! assert_eq!(Utc.ymd_opt(2014, 7, 8).and_hms_opt(21, 15, 33),
-//!            LocalResult::Single(Utc.ymd(2014, 7, 8).and_hms(21, 15, 33)));
-//! assert_eq!(Utc.ymd_opt(2014, 7, 8).and_hms_opt(80, 15, 33), LocalResult::None);
-//! assert_eq!(Utc.ymd_opt(2014, 7, 38).and_hms_opt(21, 15, 33), LocalResult::None);
+//! assert_eq!(UTC.ymd_opt(2014, 7, 8).and_hms_opt(21, 15, 33),
+//!            LocalResult::Single(UTC.ymd(2014, 7, 8).and_hms(21, 15, 33)));
+//! assert_eq!(UTC.ymd_opt(2014, 7, 8).and_hms_opt(80, 15, 33), LocalResult::None);
+//! assert_eq!(UTC.ymd_opt(2014, 7, 38).and_hms_opt(21, 15, 33), LocalResult::None);
 //!
 //! // other time zone objects can be used to construct a local datetime.
 //! // obviously, `local_dt` is normally different from `dt`, but `fixed_dt` should be identical.
 //! let local_dt = Local.ymd(2014, 7, 8).and_hms_milli(9, 10, 11, 12);
 //! let fixed_dt = FixedOffset::east(9 * 3600).ymd(2014, 7, 8).and_hms_milli(18, 10, 11, 12);
 //! assert_eq!(dt, fixed_dt);
 //! # let _ = local_dt;
-//! ```
+//! ~~~~
 //!
 //! Various properties are available to the date and time, and can be altered individually.
 //! Most of them are defined in the traits [`Datelike`](./trait.Datelike.html) and
 //! [`Timelike`](./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:
 //!
-//! ```rust
-//! # extern crate chrono; extern crate time; fn main() {
-//! use chrono::prelude::*;
-//! use time::Duration;
+//! ~~~~ {.rust}
+//! use chrono::*;
 //!
 //! # /* we intentionally fake the datetime...
 //! // assume this returned `2014-11-28T21:45:59.324310806+09:00`:
 //! let dt = Local::now();
 //! # */ // up to here. we now define a fixed datetime for the illustrative purpose.
 //! # let dt = FixedOffset::east(9*3600).ymd(2014, 11, 28).and_hms_nano(21, 45, 59, 324310806);
 //!
 //! // property accessors
@@ -173,347 +151,238 @@
 //! assert_eq!((dt.month0(), dt.day0()), (10, 27)); // for unfortunate souls
 //! assert_eq!((dt.hour(), dt.minute(), dt.second()), (21, 45, 59));
 //! assert_eq!(dt.weekday(), Weekday::Fri);
 //! assert_eq!(dt.weekday().number_from_monday(), 5); // Mon=1, ..., Sat=7
 //! assert_eq!(dt.ordinal(), 332); // the day of year
 //! assert_eq!(dt.num_days_from_ce(), 735565); // the number of days from and including Jan 1, 1
 //!
 //! // time zone accessor and manipulation
-//! assert_eq!(dt.offset().fix().local_minus_utc(), 9 * 3600);
+//! assert_eq!(dt.offset().local_minus_utc(), Duration::hours(9));
 //! assert_eq!(dt.timezone(), FixedOffset::east(9 * 3600));
-//! assert_eq!(dt.with_timezone(&Utc), Utc.ymd(2014, 11, 28).and_hms_nano(12, 45, 59, 324310806));
+//! assert_eq!(dt.with_timezone(&UTC), UTC.ymd(2014, 11, 28).and_hms_nano(12, 45, 59, 324310806));
 //!
 //! // a sample of property manipulations (validates dynamically)
 //! assert_eq!(dt.with_day(29).unwrap().weekday(), Weekday::Sat); // 2014-11-29 is Saturday
 //! assert_eq!(dt.with_day(32), None);
 //! assert_eq!(dt.with_year(-300).unwrap().num_days_from_ce(), -109606); // November 29, 301 BCE
 //!
 //! // arithmetic operations
-//! let dt1 = Utc.ymd(2014, 11, 14).and_hms(8, 9, 10);
-//! let dt2 = Utc.ymd(2014, 11, 14).and_hms(10, 9, 8);
-//! assert_eq!(dt1.signed_duration_since(dt2), Duration::seconds(-2 * 3600 + 2));
-//! assert_eq!(dt2.signed_duration_since(dt1), Duration::seconds(2 * 3600 - 2));
-//! assert_eq!(Utc.ymd(1970, 1, 1).and_hms(0, 0, 0) + Duration::seconds(1_000_000_000),
-//!            Utc.ymd(2001, 9, 9).and_hms(1, 46, 40));
-//! assert_eq!(Utc.ymd(1970, 1, 1).and_hms(0, 0, 0) - Duration::seconds(1_000_000_000),
-//!            Utc.ymd(1938, 4, 24).and_hms(22, 13, 20));
-//! # }
-//! ```
+//! assert_eq!(UTC.ymd(2014, 11, 14).and_hms(8, 9, 10) - UTC.ymd(2014, 11, 14).and_hms(10, 9, 8),
+//!            Duration::seconds(-2 * 3600 + 2));
+//! assert_eq!(UTC.ymd(1970, 1, 1).and_hms(0, 0, 0) + Duration::seconds(1_000_000_000),
+//!            UTC.ymd(2001, 9, 9).and_hms(1, 46, 40));
+//! assert_eq!(UTC.ymd(1970, 1, 1).and_hms(0, 0, 0) - Duration::seconds(1_000_000_000),
+//!            UTC.ymd(1938, 4, 24).and_hms(22, 13, 20));
+//! ~~~~
 //!
-//! ### Formatting and Parsing
-//!
-//! Formatting is done via the [`format`](./struct.DateTime.html#method.format) method,
+//! Formatting is done via the [`format`](./datetime/struct.DateTime.html#method.format) method,
 //! which format is equivalent to the familiar `strftime` format.
-//!
-//! See [`format::strftime`](./format/strftime/index.html#specifiers)
-//! documentation for full syntax and list of specifiers.
+//! (See the [`format::strftime` module documentation](./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`](./struct.DateTime.html#method.to_rfc2822) and
-//! [`to_rfc3339`](./struct.DateTime.html#method.to_rfc3339) methods
+//! Chrono also provides [`to_rfc2822`](./datetime/struct.DateTime.html#method.to_rfc2822) and
+//! [`to_rfc3339`](./datetime/struct.DateTime.html#method.to_rfc3339) methods
 //! for well-known formats.
 //!
-//! ```rust
-//! use chrono::prelude::*;
+//! ~~~~ {.rust}
+//! use chrono::*;
 //!
-//! let dt = Utc.ymd(2014, 11, 28).and_hms(12, 0, 9);
+//! let dt = UTC.ymd(2014, 11, 28).and_hms(12, 0, 9);
 //! assert_eq!(dt.format("%Y-%m-%d %H:%M:%S").to_string(), "2014-11-28 12:00:09");
 //! assert_eq!(dt.format("%a %b %e %T %Y").to_string(), "Fri Nov 28 12:00:09 2014");
 //! assert_eq!(dt.format("%a %b %e %T %Y").to_string(), dt.format("%c").to_string());
 //!
 //! assert_eq!(dt.to_string(), "2014-11-28 12:00:09 UTC");
 //! assert_eq!(dt.to_rfc2822(), "Fri, 28 Nov 2014 12:00:09 +0000");
 //! assert_eq!(dt.to_rfc3339(), "2014-11-28T12:00:09+00:00");
 //! assert_eq!(format!("{:?}", dt), "2014-11-28T12:00:09Z");
-//!
-//! // Note that milli/nanoseconds are only printed if they are non-zero
-//! let dt_nano = Utc.ymd(2014, 11, 28).and_hms_nano(12, 0, 9, 1);
-//! assert_eq!(format!("{:?}", dt_nano), "2014-11-28T12:00:09.000000001Z");
-//! ```
+//! ~~~~
 //!
 //! Parsing can be done with three methods:
 //!
 //! 1. The standard [`FromStr`](https://doc.rust-lang.org/std/str/trait.FromStr.html) trait
 //!    (and [`parse`](https://doc.rust-lang.org/std/primitive.str.html#method.parse) method
-//!    on a string) can be used for parsing `DateTime<FixedOffset>`, `DateTime<Utc>` and
+//!    on a string) can be used for parsing `DateTime<FixedOffset>`, `DateTime<UTC>` and
 //!    `DateTime<Local>` values. This parses what the `{:?}`
 //!    ([`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`](./struct.DateTime.html#method.parse_from_str) parses
+//! 2. [`DateTime::parse_from_str`](./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`](./struct.DateTime.html#method.parse_from_rfc2822)
+//!    [`DateTime::parse_from_rfc2822`](./datetime/struct.DateTime.html#method.parse_from_rfc2822)
 //!    and
-//!    [`DateTime::parse_from_rfc3339`](./struct.DateTime.html#method.parse_from_rfc3339)
+//!    [`DateTime::parse_from_rfc3339`](./datetime/struct.DateTime.html#method.parse_from_rfc3339)
 //!    are similar but for well-known formats.
 //!
 //! 3. [`Offset::datetime_from_str`](./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`](./format/index.html) module.
 //!
-//! ```rust
-//! use chrono::prelude::*;
+//! ~~~~ {.rust}
+//! use chrono::*;
 //!
-//! let dt = Utc.ymd(2014, 11, 28).and_hms(12, 0, 9);
+//! let dt = UTC.ymd(2014, 11, 28).and_hms(12, 0, 9);
 //! let fixed_dt = dt.with_timezone(&FixedOffset::east(9*3600));
 //!
 //! // method 1
-//! assert_eq!("2014-11-28T12:00:09Z".parse::<DateTime<Utc>>(), Ok(dt.clone()));
-//! assert_eq!("2014-11-28T21:00:09+09:00".parse::<DateTime<Utc>>(), Ok(dt.clone()));
+//! assert_eq!("2014-11-28T12:00:09Z".parse::<DateTime<UTC>>(), Ok(dt.clone()));
+//! assert_eq!("2014-11-28T21:00:09+09:00".parse::<DateTime<UTC>>(), Ok(dt.clone()));
 //! assert_eq!("2014-11-28T21:00:09+09:00".parse::<DateTime<FixedOffset>>(), Ok(fixed_dt.clone()));
 //!
 //! // method 2
 //! assert_eq!(DateTime::parse_from_str("2014-11-28 21:00:09 +09:00", "%Y-%m-%d %H:%M:%S %z"),
 //!            Ok(fixed_dt.clone()));
 //! assert_eq!(DateTime::parse_from_rfc2822("Fri, 28 Nov 2014 21:00:09 +0900"),
 //!            Ok(fixed_dt.clone()));
 //! assert_eq!(DateTime::parse_from_rfc3339("2014-11-28T21:00:09+09:00"), Ok(fixed_dt.clone()));
 //!
 //! // method 3
-//! assert_eq!(Utc.datetime_from_str("2014-11-28 12:00:09", "%Y-%m-%d %H:%M:%S"), Ok(dt.clone()));
-//! assert_eq!(Utc.datetime_from_str("Fri Nov 28 12:00:09 2014", "%a %b %e %T %Y"), Ok(dt.clone()));
+//! assert_eq!(UTC.datetime_from_str("2014-11-28 12:00:09", "%Y-%m-%d %H:%M:%S"), Ok(dt.clone()));
+//! assert_eq!(UTC.datetime_from_str("Fri Nov 28 12:00:09 2014", "%a %b %e %T %Y"), Ok(dt.clone()));
 //!
 //! // oops, the year is missing!
-//! assert!(Utc.datetime_from_str("Fri Nov 28 12:00:09", "%a %b %e %T %Y").is_err());
+//! assert!(UTC.datetime_from_str("Fri Nov 28 12:00:09", "%a %b %e %T %Y").is_err());
 //! // oops, the format string does not include the year at all!
-//! assert!(Utc.datetime_from_str("Fri Nov 28 12:00:09", "%a %b %e %T").is_err());
+//! assert!(UTC.datetime_from_str("Fri Nov 28 12:00:09", "%a %b %e %T").is_err());
 //! // oops, the weekday is incorrect!
-//! assert!(Utc.datetime_from_str("Sat Nov 28 12:00:09 2014", "%a %b %e %T %Y").is_err());
-//! ```
-//!
-//! Again : See [`format::strftime`](./format/strftime/index.html#specifiers)
-//! documentation for full syntax and list of specifiers.
-//!
-//! ### Conversion from and to EPOCH timestamps
-//!
-//! Use [`Utc.timestamp(seconds, nanoseconds)`](./offset/trait.TimeZone.html#method.timestamp)
-//! to construct a [`DateTime<Utc>`](./struct.DateTime.html) from a UNIX timestamp
-//! (seconds, nanoseconds that passed since January 1st 1970).
-//!
-//! Use [`DateTime.timestamp`](./struct.DateTime.html#method.timestamp) to get the timestamp (in seconds)
-//! from a [`DateTime`](./struct.DateTime.html). Additionally, you can use
-//! [`DateTime.timestamp_subsec_nanos`](./struct.DateTime.html#method.timestamp_subsec_nanos)
-//! to get the number of additional number of nanoseconds.
-//!
-//! ```rust
-//! # use chrono::DateTime;
-//! # use chrono::Utc;
-//! // We need the trait in scope to use Utc::timestamp().
-//! use chrono::TimeZone;
-//!
-//! // Construct a datetime from epoch:
-//! let dt = Utc.timestamp(1_500_000_000, 0);
-//! assert_eq!(dt.to_rfc2822(), "Fri, 14 Jul 2017 02:40:00 +0000");
-//!
-//! // Get epoch value from a datetime:
-//! let dt = DateTime::parse_from_rfc2822("Fri, 14 Jul 2017 02:40:00 +0000").unwrap();
-//! assert_eq!(dt.timestamp(), 1_500_000_000);
-//! ```
+//! assert!(UTC.datetime_from_str("Sat Nov 28 12:00:09 2014", "%a %b %e %T %Y").is_err());
+//! ~~~~
 //!
 //! ### Individual date
 //!
-//! Chrono also provides an individual date type ([**`Date`**](./struct.Date.html)).
+//! Chrono also provides an individual date type ([**`Date`**](./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.
 //!
-//! ```rust
-//! use chrono::prelude::*;
-//! use chrono::offset::LocalResult;
+//! ~~~~ {.rust}
+//! use chrono::*;
 //!
 //! # // these *may* fail, but only very rarely. just rerun the test if you were that unfortunate ;)
-//! assert_eq!(Utc::today(), Utc::now().date());
+//! assert_eq!(UTC::today(), UTC::now().date());
 //! assert_eq!(Local::today(), Local::now().date());
 //!
-//! assert_eq!(Utc.ymd(2014, 11, 28).weekday(), Weekday::Fri);
-//! assert_eq!(Utc.ymd_opt(2014, 11, 31), LocalResult::None);
-//! assert_eq!(Utc.ymd(2014, 11, 28).and_hms_milli(7, 8, 9, 10).format("%H%M%S").to_string(),
+//! assert_eq!(UTC.ymd(2014, 11, 28).weekday(), Weekday::Fri);
+//! assert_eq!(UTC.ymd_opt(2014, 11, 31), LocalResult::None);
+//! assert_eq!(UTC.ymd(2014, 11, 28).and_hms_milli(7, 8, 9, 10).format("%H%M%S").to_string(),
 //!            "070809");
-//! ```
+//! ~~~~
 //!
 //! There is no timezone-aware `Time` due to the lack of usefulness and also the complexity.
 //!
-//! `DateTime` has [`date`](./struct.DateTime.html#method.date) method
+//! `DateTime` has [`date`](./datetime/struct.DateTime.html#method.date) method
 //! which returns a `Date` which represents its date component.
-//! There is also a [`time`](./struct.DateTime.html#method.time) method,
+//! There is also a [`time`](./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`**](./naive/struct.NaiveDate.html),
-//! [**`NaiveTime`**](./naive/struct.NaiveTime.html) and
-//! [**`NaiveDateTime`**](./naive/struct.NaiveDateTime.html) respectively.
+//! as [**`NaiveDate`**](./naive/date/struct.NaiveDate.html),
+//! [**`NaiveTime`**](./naive/time/struct.NaiveTime.html) and
+//! [**`NaiveDateTime`**](./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`](./struct.DateTime.html#method.naive_local) returns
+//! [`naive_local`](./datetime/struct.DateTime.html#method.naive_local) returns
 //! a view to the naive local time,
-//! and [`naive_utc`](./struct.DateTime.html#method.naive_utc) returns
+//! and [`naive_utc`](./datetime/struct.DateTime.html#method.naive_utc) returns
 //! a view to the naive UTC time.
 //!
 //! ## Limitations
 //!
 //! Only proleptic Gregorian calendar (i.e. extended to support older dates) is supported.
 //! Be very careful if you really have to deal with pre-20C dates, they can be in Julian or others.
 //!
 //! 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](./naive/struct.NaiveTime.html#leap-second-handling).
+//! Chrono doesn't try to make use of them](./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
 //! if you want.
 //!
 //! Chrono inherently does not support an inaccurate or partial date and time representation.
 //! Any operation that can be ambiguous will return `None` in such cases.
 //! For example, "a month later" of 2014-01-30 is not well-defined
-//! and consequently `Utc.ymd(2014, 1, 30).with_month(2)` returns `None`.
+//! and consequently `UTC.ymd(2014, 1, 30).with_month(2)` returns `None`.
 //!
-//! Advanced time zone handling is not yet supported.
-//! For now you can try the [Chrono-tz](https://github.com/chronotope/chrono-tz/) crate instead.
+//! Advanced time zone handling is not yet supported (but is planned in 0.3).
 
-#![doc(html_root_url = "https://docs.rs/chrono/latest/")]
+#![doc(html_root_url = "https://lifthrasiir.github.io/rust-chrono/")]
 
 #![cfg_attr(bench, feature(test))] // lib stability features as per RFC #507
 #![deny(missing_docs)]
-#![deny(missing_debug_implementations)]
 
-// The explicit 'static lifetimes are still needed for rustc 1.13-16
-// backward compatibility, and this appeases clippy. If minimum rustc
-// becomes 1.17, should be able to remove this, those 'static lifetimes,
-// and use `static` in a lot of places `const` is used now.
-//
-// Similarly, redundant_field_names lints on not using the
-// field-init-shorthand, which was stabilized in rust 1.17.
-//
-// Changing trivially_copy_pass_by_ref would require an incompatible version
-// bump.
-#![cfg_attr(feature = "cargo-clippy", allow(
-    const_static_lifetime,
-    redundant_field_names,
-    trivially_copy_pass_by_ref,
-))]
-
-#[cfg(feature="clock")]
-extern crate time as oldtime;
-extern crate num_integer;
-extern crate num_traits;
+extern crate time as stdtime;
+extern crate num;
 #[cfg(feature = "rustc-serialize")]
 extern crate rustc_serialize;
 #[cfg(feature = "serde")]
-extern crate serde as serdelib;
-
-// this reexport is to aid the transition and should not be in the prelude!
-pub use oldtime::Duration;
+extern crate serde;
 
-#[cfg(feature="clock")]
-#[doc(no_inline)] pub use offset::Local;
-#[doc(no_inline)] pub use offset::{TimeZone, Offset, LocalResult, Utc, FixedOffset};
-#[doc(no_inline)] pub use naive::{NaiveDate, IsoWeek, NaiveTime, NaiveDateTime};
-pub use date::{Date, MIN_DATE, MAX_DATE};
-pub use datetime::{DateTime, SecondsFormat};
-#[cfg(feature = "rustc-serialize")]
-pub use datetime::rustc_serialize::TsSeconds;
+pub use duration::Duration;
+pub use offset::{TimeZone, Offset, LocalResult};
+pub use offset::utc::UTC;
+pub use offset::fixed::FixedOffset;
+pub use offset::local::Local;
+pub use naive::date::NaiveDate;
+pub use naive::time::NaiveTime;
+pub use naive::datetime::NaiveDateTime;
+pub use date::Date;
+pub use datetime::DateTime;
 pub use format::{ParseError, ParseResult};
-pub use round::SubsecRound;
-
-/// A convenience module appropriate for glob imports (`use chrono::prelude::*;`).
-pub mod prelude {
-    #[doc(no_inline)] pub use {Datelike, Timelike, Weekday};
-    #[doc(no_inline)] pub use {TimeZone, Offset};
-    #[cfg(feature="clock")]
-    #[doc(no_inline)] pub use Local;
-    #[doc(no_inline)] pub use {Utc, FixedOffset};
-    #[doc(no_inline)] pub use {NaiveDate, NaiveTime, NaiveDateTime};
-    #[doc(no_inline)] pub use Date;
-    #[doc(no_inline)] pub use {DateTime, SecondsFormat};
-    #[doc(no_inline)] pub use SubsecRound;
-}
 
 // useful throughout the codebase
 macro_rules! try_opt {
     ($e:expr) => (match $e { Some(v) => v, None => return None })
 }
 
 mod div;
-#[cfg(not(feature="clock"))]
-mod oldtime;
+pub mod duration {
+    //! ISO 8601 duration.
+    //!
+    //! This used to be a part of rust-chrono,
+    //! but has been subsequently merged into Rust's standard library.
+    pub use stdtime::Duration;
+}
 pub mod offset;
 pub mod naive {
     //! Date and time types which do not concern about the timezones.
     //!
     //! They are primarily building blocks for other types
     //! (e.g. [`TimeZone`](../offset/trait.TimeZone.html)),
     //! but can be also used for the simpler date and time handling.
-
-    mod internals;
-    mod date;
-    mod isoweek;
-    mod time;
-    mod datetime;
-
-    pub use self::date::{NaiveDate, MIN_DATE, MAX_DATE};
-    pub use self::isoweek::IsoWeek;
-    pub use self::time::NaiveTime;
-    pub use self::datetime::NaiveDateTime;
-    #[cfg(feature = "rustc-serialize")]
-    #[allow(deprecated)]
-    pub use self::datetime::rustc_serialize::TsSeconds;
-
-
-    /// Serialization/Deserialization of naive types in alternate formats
-    ///
-    /// The various modules in here are intended to be used with serde's [`with`
-    /// annotation][1] to serialize as something other than the default [RFC
-    /// 3339][2] format.
-    ///
-    /// [1]: https://serde.rs/attributes.html#field-attributes
-    /// [2]: https://tools.ietf.org/html/rfc3339
-    #[cfg(feature = "serde")]
-    pub mod serde {
-        pub use super::datetime::serde::*;
-    }
+    pub mod date;
+    pub mod time;
+    pub mod datetime;
 }
-mod date;
-mod datetime;
+pub mod date;
+pub mod datetime;
 pub mod format;
-mod round;
-
-/// Serialization/Deserialization in alternate formats
-///
-/// The various modules in here are intended to be used with serde's [`with`
-/// annotation][1] to serialize as something other than the default [RFC
-/// 3339][2] format.
-///
-/// [1]: https://serde.rs/attributes.html#field-attributes
-/// [2]: https://tools.ietf.org/html/rfc3339
-#[cfg(feature = "serde")]
-pub mod serde {
-    pub use super::datetime::serde::*;
-}
 
 /// The day of week.
 ///
 /// The order of the days of week depends on the context.
 /// (This is why this type does *not* implement `PartialOrd` or `Ord` traits.)
 /// One should prefer `*_from_monday` or `*_from_sunday` methods to get the correct result.
-#[derive(PartialEq, Eq, Copy, Clone, Debug, Hash)]
+#[derive(PartialEq, Eq, Copy, Clone, Debug)]
 #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
 pub enum Weekday {
     /// Monday.
     Mon = 0,
     /// Tuesday.
     Tue = 1,
     /// Wednesday.
     Wed = 2,
@@ -635,17 +504,17 @@ impl Weekday {
             Weekday::Sun => 0,
         }
     }
 }
 
 /// Any weekday can be represented as an integer from 0 to 6, which equals to
 /// [`Weekday::num_days_from_monday`](#method.num_days_from_monday) in this implementation.
 /// Do not heavily depend on this though; use explicit methods whenever possible.
-impl num_traits::FromPrimitive for Weekday {
+impl num::traits::FromPrimitive for Weekday {
     #[inline]
     fn from_i64(n: i64) -> Option<Weekday> {
         match n {
             0 => Some(Weekday::Mon),
             1 => Some(Weekday::Tue),
             2 => Some(Weekday::Wed),
             3 => Some(Weekday::Thu),
             4 => Some(Weekday::Fri),
@@ -665,141 +534,20 @@ impl num_traits::FromPrimitive for Weekd
             4 => Some(Weekday::Fri),
             5 => Some(Weekday::Sat),
             6 => Some(Weekday::Sun),
             _ => None,
         }
     }
 }
 
-use std::fmt;
-
-/// An error resulting from reading `Weekday` value with `FromStr`.
-#[derive(Clone, PartialEq)]
-pub struct ParseWeekdayError {
-    _dummy: (),
-}
-
-impl fmt::Debug for ParseWeekdayError {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "ParseWeekdayError {{ .. }}")
-    }
-}
-
-// the actual `FromStr` implementation is in the `format` module to leverage the existing code
-
-#[cfg(feature = "serde")]
-mod weekday_serde {
-    use super::Weekday;
-    use std::fmt;
-    use serdelib::{ser, de};
-
-    impl ser::Serialize for Weekday {
-        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
-            where S: ser::Serializer
-        {
-            serializer.serialize_str(&format!("{:?}", self))
-        }
-    }
-
-    struct WeekdayVisitor;
-
-    impl<'de> de::Visitor<'de> for WeekdayVisitor {
-        type Value = Weekday;
-
-        fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result {
-            write!(f, "Weekday")
-        }
-
-        fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
-            where E: de::Error
-        {
-            value.parse().map_err(|_| E::custom("short or long weekday names expected"))
-        }
-    }
-
-    impl<'de> de::Deserialize<'de> for Weekday {
-        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
-            where D: de::Deserializer<'de>
-        {
-            deserializer.deserialize_str(WeekdayVisitor)
-        }
-    }
-
-    #[cfg(test)]
-    extern crate serde_json;
-
-    #[test]
-    fn test_serde_serialize() {
-        use self::serde_json::to_string;
-        use Weekday::*;
-
-        let cases: Vec<(Weekday, &str)> = vec![
-            (Mon, "\"Mon\""),
-            (Tue, "\"Tue\""),
-            (Wed, "\"Wed\""),
-            (Thu, "\"Thu\""),
-            (Fri, "\"Fri\""),
-            (Sat, "\"Sat\""),
-            (Sun, "\"Sun\""),
-        ];
-
-        for (weekday, expected_str) in cases {
-            let string = to_string(&weekday).unwrap();
-            assert_eq!(string, expected_str);
-        }
-    }
-
-    #[test]
-    fn test_serde_deserialize() {
-        use self::serde_json::from_str;
-        use Weekday::*;
-
-        let cases: Vec<(&str, Weekday)> = vec![
-            ("\"mon\"", Mon),
-            ("\"MONDAY\"", Mon),
-            ("\"MonDay\"", Mon),
-            ("\"mOn\"", Mon),
-            ("\"tue\"", Tue),
-            ("\"tuesday\"", Tue),
-            ("\"wed\"", Wed),
-            ("\"wednesday\"", Wed),
-            ("\"thu\"", Thu),
-            ("\"thursday\"", Thu),
-            ("\"fri\"", Fri),
-            ("\"friday\"", Fri),
-            ("\"sat\"", Sat),
-            ("\"saturday\"", Sat),
-            ("\"sun\"", Sun),
-            ("\"sunday\"", Sun),
-        ];
-
-        for (str, expected_weekday) in cases {
-            let weekday = from_str::<Weekday>(str).unwrap();
-            assert_eq!(weekday, expected_weekday);
-        }
-
-        let errors: Vec<&str> = vec![
-            "\"not a weekday\"",
-            "\"monDAYs\"",
-            "\"mond\"",
-            "mon",
-            "\"thur\"",
-            "\"thurs\"",
-        ];
-
-        for str in errors {
-            from_str::<Weekday>(str).unwrap_err();
-        }
-    }
-}
 
 /// The common set of methods for date component.
 pub trait Datelike: Sized {
-    /// Returns the year number in the [calendar date](./naive/struct.NaiveDate.html#calendar-date).
+    /// Returns the year number in the [calendar date](./naive/date/index.html#calendar-date).
     fn year(&self) -> i32;
 
     /// Returns the absolute year number starting from 1 with a boolean flag,
     /// which is false when the year predates the epoch (BCE/BC) and true otherwise (CE/AD).
     #[inline]
     fn year_ce(&self) -> (bool, u32) {
         let year = self.year();
         if year < 1 {
@@ -837,18 +585,19 @@ pub trait Datelike: Sized {
     /// Returns the day of year starting from 0.
     ///
     /// The return value ranges from 0 to 365. (The last day of year differs by years.)
     fn ordinal0(&self) -> u32;
 
     /// Returns the day of week.
     fn weekday(&self) -> Weekday;
 
-    /// Returns the ISO week.
-    fn iso_week(&self) -> IsoWeek;
+    /// Returns the ISO week date: an adjusted year, week number and day of week.
+    /// The adjusted year may differ from that of the calendar date.
+    fn isoweekdate(&self) -> (i32, u32, Weekday);
 
     /// Makes a new value with the year number changed.
     ///
     /// Returns `None` when the resulting value would be invalid.
     fn with_year(&self, year: i32) -> Option<Self>;
 
     /// Makes a new value with the month number (starting from 1) changed.
     ///
@@ -875,34 +624,25 @@ pub trait Datelike: Sized {
     /// Returns `None` when the resulting value would be invalid.
     fn with_ordinal(&self, ordinal: u32) -> Option<Self>;
 
     /// Makes a new value with the day of year (starting from 0) changed.
     ///
     /// Returns `None` when the resulting value would be invalid.
     fn with_ordinal0(&self, ordinal0: u32) -> Option<Self>;
 
-    /// Returns the number of days since January 1, Year 1 (aka Day 1) in the
-    /// proleptic Gregorian calendar.
-    ///
-    /// # Example:
-    ///
-    /// ~~~
-    /// use chrono::{NaiveDate, Datelike};
-    /// assert_eq!(NaiveDate::from_ymd(1970, 1, 1).num_days_from_ce(), 719163);
-    /// assert_eq!(NaiveDate::from_ymd(0, 1, 1).num_days_from_ce(), -365);
-    /// ~~~
+    /// Returns the number of days since January 1, 1 (Day 1) in the proleptic Gregorian calendar.
     fn num_days_from_ce(&self) -> i32 {
         // we know this wouldn't overflow since year is limited to 1/2^13 of i32's full range.
         let mut year = self.year() - 1;
         let mut ndays = 0;
         if year < 0 {
             let excess = 1 + (-year) / 400;
             year += excess * 400;
-            ndays -= excess * 146_097;
+            ndays -= excess * 146097;
         }
         let div_100 = year / 100;
         ndays += ((year * 1461) >> 2) - div_100 + (div_100 >> 2);
         ndays + self.ordinal() as i32
     }
 }
 
 /// The common set of methods for time component.
@@ -925,17 +665,17 @@ pub trait Timelike: Sized {
     /// Returns the minute number from 0 to 59.
     fn minute(&self) -> u32;
 
     /// Returns the second number from 0 to 59.
     fn second(&self) -> u32;
 
     /// Returns the number of nanoseconds since the whole non-leap second.
     /// The range from 1,000,000,000 to 1,999,999,999 represents
-    /// the [leap second](./naive/struct.NaiveTime.html#leap-second-handling).
+    /// the [leap second](./naive/time/index.html#leap-second-handling).
     fn nanosecond(&self) -> u32;
 
     /// Makes a new value with the hour number changed.
     ///
     /// Returns `None` when the resulting value would be invalid.
     fn with_hour(&self, hour: u32) -> Option<Self>;
 
     /// Makes a new value with the minute number changed.
@@ -959,23 +699,21 @@ pub trait Timelike: Sized {
 
     /// Returns the number of non-leap seconds past the last midnight.
     #[inline]
     fn num_seconds_from_midnight(&self) -> u32 {
         self.hour() * 3600 + self.minute() * 60 + self.second()
     }
 }
 
-#[cfg(test)] extern crate num_iter;
-
 #[test]
 fn test_readme_doomsday() {
-    use num_iter::range_inclusive;
+    use num::iter::range_inclusive;
 
-    for y in range_inclusive(naive::MIN_DATE.year(), naive::MAX_DATE.year()) {
+    for y in range_inclusive(naive::date::MIN.year(), naive::date::MAX.year()) {
         // even months
         let d4 = NaiveDate::from_ymd(y, 4, 4);
         let d6 = NaiveDate::from_ymd(y, 6, 6);
         let d8 = NaiveDate::from_ymd(y, 8, 8);
         let d10 = NaiveDate::from_ymd(y, 10, 10);
         let d12 = NaiveDate::from_ymd(y, 12, 12);
 
         // nine to five, seven-eleven
--- a/third_party/rust/chrono/src/naive/date.rs
+++ b/third_party/rust/chrono/src/naive/date.rs
@@ -1,26 +1,70 @@
-// This is a part of Chrono.
+// This is a part of rust-chrono.
+// Copyright (c) 2014-2015, Kang Seonghoon.
 // See README.md and LICENSE.txt for details.
 
 //! ISO 8601 calendar date without timezone.
+//!
+//! # Calendar Date
+//!
+//! The ISO 8601 **calendar date** follows the proleptic Gregorian calendar.
+//! It is like a normal civil calendar but note some slight differences:
+//!
+//! * Dates before the Gregorian calendar's inception in 1582 are defined via the extrapolation.
+//!   Be careful, as historical dates are often noted in the Julian calendar and others
+//!   and the transition to Gregorian may differ across countries (as late as early 20C).
+//!
+//!   (Some example: Both Shakespeare from Britain and Cervantes from Spain seemingly died
+//!   on the same calendar date---April 23, 1616---but in the different calendar.
+//!   Britain used the Julian calendar at that time, so Shakespeare's death is later.)
+//!
+//! * ISO 8601 calendars has the year 0, which is 1 BCE (a year before 1 CE).
+//!   If you need a typical BCE/BC and CE/AD notation for year numbers,
+//!   use the [`Datelike::year_ce`](../../trait.Datelike.html#method.year_ce) method.
+//!
+//! # Week Date
+//!
+//! The ISO 8601 **week date** is a triple of year number, week number
+//! and [day of the week](../../enum.Weekday.html) with the following rules:
+//!
+//! * A week consists of Monday through Sunday, and is always numbered within some year.
+//!   The week number ranges from 1 to 52 or 53 depending on the year.
+//!
+//! * The week 1 of given year is defined as the first week containing January 4 of that year,
+//!   or equivalently, the first week containing four or more days in that year.
+//!
+//! * The year number in the week date may *not* correspond to the actual Gregorian year.
+//!   For example, January 3, 2016 (Sunday) was on the last (53rd) week of 2015.
+//!
+//! Chrono's date types default to the ISO 8601 [calendar date](#calendar-date),
+//! but the [`Datelike::isoweekdate`](../../trait.Datelike.html#tymethod.isoweekdate) method
+//! can be used to get the corresponding week date.
+//!
+//! # Ordinal Date
+//!
+//! The ISO 8601 **ordinal date** is a pair of year number and day of the year ("ordinal").
+//! The ordinal number ranges from 1 to 365 or 366 depending on the year.
+//! The year number is same to that of the [calendar date](#calendar-date).
+//!
+//! This is currently the internal format of Chrono's date types.
 
-use std::{str, fmt};
-use std::ops::{Add, Sub, AddAssign, SubAssign};
-use num_traits::ToPrimitive;
-use oldtime::Duration as OldDuration;
+use std::{str, fmt, hash};
+use std::ops::{Add, Sub};
+use num::traits::ToPrimitive;
 
 use {Weekday, Datelike};
 use div::div_mod_floor;
-use naive::{NaiveTime, NaiveDateTime, IsoWeek};
+use duration::Duration;
+use naive::time::NaiveTime;
+use naive::datetime::NaiveDateTime;
 use format::{Item, Numeric, Pad};
 use format::{parse, Parsed, ParseError, ParseResult, DelayedFormat, StrftimeItems};
 
-use super::isoweek;
-use super::internals::{self, DateImpl, Of, Mdf, YearFlags};
+use self::internals::{DateImpl, Of, Mdf, YearFlags};
 
 const MAX_YEAR: i32 = internals::MAX_YEAR;
 const MIN_YEAR: i32 = internals::MIN_YEAR;
 
 //   MAX_YEAR-12-31 minus 0000-01-01
 // = ((MAX_YEAR+1)-01-01 minus 0001-01-01) + (0001-01-01 minus 0000-01-01) - 1 day
 // = ((MAX_YEAR+1)-01-01 minus 0001-01-01) + 365 days
 // = MAX_YEAR * 365 + (# of leap years from 0001 to MAX_YEAR) + 365 days
@@ -37,94 +81,39 @@ const MAX_DAYS_FROM_YEAR_0: i32 = MAX_YE
 //
 // n is set to 1000 for convenience.
 #[cfg(test)] // only used for testing
 const MIN_DAYS_FROM_YEAR_0: i32 = (MIN_YEAR + 400_000) * 365 +
                                   (MIN_YEAR + 400_000) / 4 -
                                   (MIN_YEAR + 400_000) / 100 +
                                   (MIN_YEAR + 400_000) / 400 - 146097_000;
 
-#[cfg(test)] // only used for testing, but duplicated in naive::datetime
-const MAX_BITS: usize = 44;
-
 /// ISO 8601 calendar date without timezone.
-/// Allows for every [proleptic Gregorian date](#calendar-date)
+/// Allows for every [proleptic Gregorian date](./index.html#calendar-date)
 /// from Jan 1, 262145 BCE to Dec 31, 262143 CE.
 /// Also supports the conversion from ISO 8601 ordinal and week date.
-///
-/// # Calendar Date
-///
-/// The ISO 8601 **calendar date** follows the proleptic Gregorian calendar.
-/// It is like a normal civil calendar but note some slight differences:
-///
-/// * Dates before the Gregorian calendar's inception in 1582 are defined via the extrapolation.
-///   Be careful, as historical dates are often noted in the Julian calendar and others
-///   and the transition to Gregorian may differ across countries (as late as early 20C).
-///
-///   (Some example: Both Shakespeare from Britain and Cervantes from Spain seemingly died
-///   on the same calendar date---April 23, 1616---but in the different calendar.
-///   Britain used the Julian calendar at that time, so Shakespeare's death is later.)
-///
-/// * ISO 8601 calendars has the year 0, which is 1 BCE (a year before 1 CE).
-///   If you need a typical BCE/BC and CE/AD notation for year numbers,
-///   use the [`Datelike::year_ce`](../trait.Datelike.html#method.year_ce) method.
-///
-/// # Week Date
-///
-/// The ISO 8601 **week date** is a triple of year number, week number
-/// and [day of the week](../enum.Weekday.html) with the following rules:
-///
-/// * A week consists of Monday through Sunday, and is always numbered within some year.
-///   The week number ranges from 1 to 52 or 53 depending on the year.
-///
-/// * The week 1 of given year is defined as the first week containing January 4 of that year,
-///   or equivalently, the first week containing four or more days in that year.
-///
-/// * The year number in the week date may *not* correspond to the actual Gregorian year.
-///   For example, January 3, 2016 (Sunday) was on the last (53rd) week of 2015.
-///
-/// Chrono's date types default to the ISO 8601 [calendar date](#calendar-date),
-/// but [`Datelike::iso_week`](../trait.Datelike.html#tymethod.iso_week) and
-/// [`Datelike::weekday`](../trait.Datelike.html#tymethod.weekday) methods
-/// can be used to get the corresponding week date.
-///
-/// # Ordinal Date
-///
-/// The ISO 8601 **ordinal date** is a pair of year number and day of the year ("ordinal").
-/// The ordinal number ranges from 1 to 365 or 366 depending on the year.
-/// The year number is same to that of the [calendar date](#calendar-date).
-///
-/// This is currently the internal format of Chrono's date types.
-#[derive(PartialEq, Eq, Hash, PartialOrd, Ord, Copy, Clone)]
+#[derive(PartialEq, Eq, PartialOrd, Ord, Copy, Clone)]
 pub struct NaiveDate {
     ymdf: DateImpl, // (year << 13) | of
 }
 
 /// The minimum possible `NaiveDate` (January 1, 262145 BCE).
-pub const MIN_DATE: NaiveDate = NaiveDate { ymdf: (MIN_YEAR << 13) | (1 << 4) | 0o07 /*FE*/ };
+pub const MIN: NaiveDate = NaiveDate { ymdf: (MIN_YEAR << 13) | (1 << 4) | 0o07 /*FE*/ };
 /// The maximum possible `NaiveDate` (December 31, 262143 CE).
-pub const MAX_DATE: NaiveDate = NaiveDate { ymdf: (MAX_YEAR << 13) | (365 << 4) | 0o17 /*F*/ };
+pub const MAX: NaiveDate = NaiveDate { ymdf: (MAX_YEAR << 13) | (365 << 4) | 0o17 /*F*/ };
 
-// as it is hard to verify year flags in `MIN_DATE` and `MAX_DATE`,
-// we use a separate run-time test.
+// as it is hard to verify year flags in `MIN` and `MAX`, we use a separate run-time test.
 #[test]
 fn test_date_bounds() {
     let calculated_min = NaiveDate::from_ymd(MIN_YEAR, 1, 1);
     let calculated_max = NaiveDate::from_ymd(MAX_YEAR, 12, 31);
-    assert!(MIN_DATE == calculated_min,
-            "`MIN_DATE` should have a year flag {:?}", calculated_min.of().flags());
-    assert!(MAX_DATE == calculated_max,
-            "`MAX_DATE` should have a year flag {:?}", calculated_max.of().flags());
-
-    // let's also check that the entire range do not exceed 2^44 seconds
-    // (sometimes used for bounding `Duration` against overflow)
-    let maxsecs = MAX_DATE.signed_duration_since(MIN_DATE).num_seconds();
-    let maxsecs = maxsecs + 86401; // also take care of DateTime
-    assert!(maxsecs < (1 << MAX_BITS),
-            "The entire `NaiveDate` range somehow exceeds 2^{} seconds", MAX_BITS);
+    assert!(MIN == calculated_min,
+            "`MIN` should have a year flag {:?}", calculated_min.of().flags());
+    assert!(MAX == calculated_max,
+            "`MAX` should have a year flag {:?}", calculated_max.of().flags());
 }
 
 impl NaiveDate {
     /// Makes a new `NaiveDate` from year and packed ordinal-flags, with a verification.
     fn from_of(year: i32, of: Of) -> Option<NaiveDate> {
         if year >= MIN_YEAR && year <= MAX_YEAR && of.valid() {
             let Of(of) = of;
             Some(NaiveDate { ymdf: (year << 13) | (of as DateImpl) })
@@ -133,181 +122,193 @@ impl NaiveDate {
         }
     }
 
     /// Makes a new `NaiveDate` from year and packed month-day-flags, with a verification.
     fn from_mdf(year: i32, mdf: Mdf) -> Option<NaiveDate> {
         NaiveDate::from_of(year, mdf.to_of())
     }
 
-    /// Makes a new `NaiveDate` from the [calendar date](#calendar-date)
+    /// Makes a new `NaiveDate` from the serialized representation.
+    /// Used for serialization formats.
+    #[cfg(feature = "rustc-serialize")]
+    fn from_serialized(ymdf: i32) -> Option<NaiveDate> {
+        // check if the year flag is correct
+        if (ymdf & 0b1111) as u8 != YearFlags::from_year(ymdf >> 13).0 { return None; }
+
+        // check if the ordinal is in the range
+        let date = NaiveDate { ymdf: ymdf };
+        if !date.of().valid() { return None; }
+
+        Some(date)
+    }
+
+    /// Returns a serialized representation of this `NaiveDate`.
+    #[cfg(feature = "rustc-serialize")]
+    fn to_serialized(&self) -> i32 {
+        self.ymdf
+    }
+
+    /// Makes a new `NaiveDate` from the [calendar date](./index.html#calendar-date)
     /// (year, month and day).
     ///
     /// Panics on the out-of-range date, invalid month and/or day.
     ///
     /// # Example
     ///
     /// ~~~~
     /// use chrono::{NaiveDate, Datelike, Weekday};
     ///
     /// let d = NaiveDate::from_ymd(2015, 3, 14);
     /// assert_eq!(d.year(), 2015);
     /// assert_eq!(d.month(), 3);
     /// assert_eq!(d.day(), 14);
     /// assert_eq!(d.ordinal(), 73); // day of year
-    /// assert_eq!(d.iso_week().year(), 2015);
-    /// assert_eq!(d.iso_week().week(), 11);
-    /// assert_eq!(d.weekday(), Weekday::Sat);
+    /// assert_eq!(d.isoweekdate(), (2015, 11, Weekday::Sat)); // ISO week and weekday
     /// assert_eq!(d.num_days_from_ce(), 735671); // days since January 1, 1 CE
     /// ~~~~
     pub fn from_ymd(year: i32, month: u32, day: u32) -> NaiveDate {
         NaiveDate::from_ymd_opt(year, month, day).expect("invalid or out-of-range date")
     }
 
-    /// Makes a new `NaiveDate` from the [calendar date](#calendar-date)
+    /// Makes a new `NaiveDate` from the [calendar date](./index.html#calendar-date)
     /// (year, month and day).
     ///
     /// Returns `None` on the out-of-range date, invalid month and/or day.
     ///
     /// # Example
     ///
     /// ~~~~
     /// use chrono::NaiveDate;
     ///
-    /// let from_ymd_opt = NaiveDate::from_ymd_opt;
-    ///
-    /// assert!(from_ymd_opt(2015, 3, 14).is_some());
-    /// assert!(from_ymd_opt(2015, 0, 14).is_none());
-    /// assert!(from_ymd_opt(2015, 2, 29).is_none());
-    /// assert!(from_ymd_opt(-4, 2, 29).is_some()); // 5 BCE is a leap year
-    /// assert!(from_ymd_opt(400000, 1, 1).is_none());
-    /// assert!(from_ymd_opt(-400000, 1, 1).is_none());
+    /// let ymd = |y,m,d| NaiveDate::from_ymd_opt(y, m, d);
+    /// assert!(ymd(2015, 3, 14).is_some());
+    /// assert!(ymd(2015, 0, 14).is_none());
+    /// assert!(ymd(2015, 2, 29).is_none());
+    /// assert!(ymd(-4, 2, 29).is_some()); // 5 BCE is a leap year
+    /// assert!(ymd(400000, 1, 1).is_none());
+    /// assert!(ymd(-400000, 1, 1).is_none());
     /// ~~~~
     pub fn from_ymd_opt(year: i32, month: u32, day: u32) -> Option<NaiveDate> {
         let flags = YearFlags::from_year(year);
         NaiveDate::from_mdf(year, Mdf::new(month, day, flags))
     }
 
-    /// Makes a new `NaiveDate` from the [ordinal date](#ordinal-date)
+    /// Makes a new `NaiveDate` from the [ordinal date](./index.html#ordinal-date)
     /// (year and day of the year).
     ///
     /// Panics on the out-of-range date and/or invalid day of year.
     ///
     /// # Example
     ///
     /// ~~~~
     /// use chrono::{NaiveDate, Datelike, Weekday};
     ///
     /// let d = NaiveDate::from_yo(2015, 73);
     /// assert_eq!(d.ordinal(), 73);
     /// assert_eq!(d.year(), 2015);
     /// assert_eq!(d.month(), 3);
     /// assert_eq!(d.day(), 14);
-    /// assert_eq!(d.iso_week().year(), 2015);
-    /// assert_eq!(d.iso_week().week(), 11);
-    /// assert_eq!(d.weekday(), Weekday::Sat);
+    /// assert_eq!(d.isoweekdate(), (2015, 11, Weekday::Sat)); // ISO week and weekday
     /// assert_eq!(d.num_days_from_ce(), 735671); // days since January 1, 1 CE
     /// ~~~~
     pub fn from_yo(year: i32, ordinal: u32) -> NaiveDate {
         NaiveDate::from_yo_opt(year, ordinal).expect("invalid or out-of-range date")
     }
 
-    /// Makes a new `NaiveDate` from the [ordinal date](#ordinal-date)
+    /// Makes a new `NaiveDate` from the [ordinal date](./index.html#ordinal-date)
     /// (year and day of the year).
     ///
     /// Returns `None` on the out-of-range date and/or invalid day of year.
     ///
     /// # Example
     ///
     /// ~~~~
     /// use chrono::NaiveDate;
     ///
-    /// let from_yo_opt = NaiveDate::from_yo_opt;
-    ///
-    /// assert!(from_yo_opt(2015, 100).is_some());
-    /// assert!(from_yo_opt(2015, 0).is_none());
-    /// assert!(from_yo_opt(2015, 365).is_some());
-    /// assert!(from_yo_opt(2015, 366).is_none());
-    /// assert!(from_yo_opt(-4, 366).is_some()); // 5 BCE is a leap year
-    /// assert!(from_yo_opt(400000, 1).is_none());
-    /// assert!(from_yo_opt(-400000, 1).is_none());
+    /// let yo = |y,o| NaiveDate::from_yo_opt(y, o);
+    /// assert!(yo(2015, 100).is_some());
+    /// assert!(yo(2015, 0).is_none());
+    /// assert!(yo(2015, 365).is_some());
+    /// assert!(yo(2015, 366).is_none());
+    /// assert!(yo(-4, 366).is_some()); // 5 BCE is a leap year
+    /// assert!(yo(400000, 1).is_none());
+    /// assert!(yo(-400000, 1).is_none());
     /// ~~~~
     pub fn from_yo_opt(year: i32, ordinal: u32) -> Option<NaiveDate> {
         let flags = YearFlags::from_year(year);
         NaiveDate::from_of(year, Of::new(ordinal, flags))
     }
 
-    /// Makes a new `NaiveDate` from the [ISO week date](#week-date)
+    /// Makes a new `NaiveDate` from the [ISO week date](./index.html#week-date)
     /// (year, week number and day of the week).
     /// The resulting `NaiveDate` may have a different year from the input year.
     ///
     /// Panics on the out-of-range date and/or invalid week number.
     ///
     /// # Example
     ///
     /// ~~~~
     /// use chrono::{NaiveDate, Datelike, Weekday};
     ///
     /// let d = NaiveDate::from_isoywd(2015, 11, Weekday::Sat);
-    /// assert_eq!(d.iso_week().year(), 2015);
-    /// assert_eq!(d.iso_week().week(), 11);
-    /// assert_eq!(d.weekday(), Weekday::Sat);
+    /// assert_eq!(d.isoweekdate(), (2015, 11, Weekday::Sat));
     /// assert_eq!(d.year(), 2015);
     /// assert_eq!(d.month(), 3);
     /// assert_eq!(d.day(), 14);
     /// assert_eq!(d.ordinal(), 73); // day of year
     /// assert_eq!(d.num_days_from_ce(), 735671); // days since January 1, 1 CE
     /// ~~~~
     pub fn from_isoywd(year: i32, week: u32, weekday: Weekday) -> NaiveDate {
         NaiveDate::from_isoywd_opt(year, week, weekday).expect("invalid or out-of-range date")
     }
 
-    /// Makes a new `NaiveDate` from the [ISO week date](#week-date)
+    /// Makes a new `NaiveDate` from the [ISO week date](./index.html#week-date)
     /// (year, week number and day of the week).
     /// The resulting `NaiveDate` may have a different year from the input year.
     ///
     /// Returns `None` on the out-of-range date and/or invalid week number.
     ///
     /// # Example
     ///
     /// ~~~~
     /// use chrono::{NaiveDate, Weekday};
     ///
-    /// let from_ymd = NaiveDate::from_ymd;
-    /// let from_isoywd_opt = NaiveDate::from_isoywd_opt;
+    /// let ymd = |y,m,d| NaiveDate::from_ymd(y, m, d);
+    /// let isoywd = |y,w,d| NaiveDate::from_isoywd_opt(y, w, d);
     ///
-    /// assert_eq!(from_isoywd_opt(2015, 0, Weekday::Sun), None);
-    /// assert_eq!(from_isoywd_opt(2015, 10, Weekday::Sun), Some(from_ymd(2015, 3, 8)));
-    /// assert_eq!(from_isoywd_opt(2015, 30, Weekday::Mon), Some(from_ymd(2015, 7, 20)));
-    /// assert_eq!(from_isoywd_opt(2015, 60, Weekday::Mon), None);
+    /// assert_eq!(isoywd(2015, 0, Weekday::Sun), None);
+    /// assert_eq!(isoywd(2015, 10, Weekday::Sun), Some(ymd(2015, 3, 8)));
+    /// assert_eq!(isoywd(2015, 30, Weekday::Mon), Some(ymd(2015, 7, 20)));
+    /// assert_eq!(isoywd(2015, 60, Weekday::Mon), None);
     ///
-    /// assert_eq!(from_isoywd_opt(400000, 10, Weekday::Fri), None);
-    /// assert_eq!(from_isoywd_opt(-400000, 10, Weekday::Sat), None);
+    /// assert_eq!(isoywd(400000, 10, Weekday::Fri), None);
+    /// assert_eq!(isoywd(-400000, 10, Weekday::Sat), None);
     /// ~~~~
     ///
     /// The year number of ISO week date may differ from that of the calendar date.
     ///
     /// ~~~~
     /// # use chrono::{NaiveDate, Weekday};
-    /// # let from_ymd = NaiveDate::from_ymd;
-    /// # let from_isoywd_opt = NaiveDate::from_isoywd_opt;
+    /// # let ymd = |y,m,d| NaiveDate::from_ymd(y, m, d);
+    /// # let isoywd = |y,w,d| NaiveDate::from_isoywd_opt(y, w, d);
     /// //           Mo Tu We Th Fr Sa Su
     /// // 2014-W52  22 23 24 25 26 27 28    has 4+ days of new year,
     /// // 2015-W01  29 30 31  1  2  3  4 <- so this is the first week
-    /// assert_eq!(from_isoywd_opt(2014, 52, Weekday::Sun), Some(from_ymd(2014, 12, 28)));
-    /// assert_eq!(from_isoywd_opt(2014, 53, Weekday::Mon), None);
-    /// assert_eq!(from_isoywd_opt(2015, 1, Weekday::Mon), Some(from_ymd(2014, 12, 29)));
+    /// assert_eq!(isoywd(2014, 52, Weekday::Sun), Some(ymd(2014, 12, 28)));
+    /// assert_eq!(isoywd(2014, 53, Weekday::Mon), None);
+    /// assert_eq!(isoywd(2015, 1, Weekday::Mon), Some(ymd(2014, 12, 29)));
     ///
     /// // 2015-W52  21 22 23 24 25 26 27    has 4+ days of old year,
     /// // 2015-W53  28 29 30 31  1  2  3 <- so this is the last week
     /// // 2016-W01   4  5  6  7  8  9 10
-    /// assert_eq!(from_isoywd_opt(2015, 52, Weekday::Sun), Some(from_ymd(2015, 12, 27)));
-    /// assert_eq!(from_isoywd_opt(2015, 53, Weekday::Sun), Some(from_ymd(2016, 1, 3)));
-    /// assert_eq!(from_isoywd_opt(2015, 54, Weekday::Mon), None);
-    /// assert_eq!(from_isoywd_opt(2016, 1, Weekday::Mon), Some(from_ymd(2016, 1, 4)));
+    /// assert_eq!(isoywd(2015, 52, Weekday::Sun), Some(ymd(2015, 12, 27)));
+    /// assert_eq!(isoywd(2015, 53, Weekday::Sun), Some(ymd(2016, 1, 3)));
+    /// assert_eq!(isoywd(2015, 54, Weekday::Mon), None);
+    /// assert_eq!(isoywd(2016, 1, Weekday::Mon), Some(ymd(2016, 1, 4)));
     /// ~~~~
     pub fn from_isoywd_opt(year: i32, week: u32, weekday: Weekday) -> Option<NaiveDate> {
         let flags = YearFlags::from_year(year);
         let nweeks = flags.nisoweeks();
         if 1 <= week && week <= nweeks {
             // ordinal = week ordinal - delta
             let weekord = week * 7 + weekday as u32;
             let delta = flags.isoweek_delta();
@@ -341,19 +342,17 @@ impl NaiveDate {
     /// use chrono::{NaiveDate, Datelike, Weekday};
     ///
     /// let d = NaiveDate::from_num_days_from_ce(735671);
     /// assert_eq!(d.num_days_from_ce(), 735671); // days since January 1, 1 CE
     /// assert_eq!(d.year(), 2015);
     /// assert_eq!(d.month(), 3);
     /// assert_eq!(d.day(), 14);
     /// assert_eq!(d.ordinal(), 73); // day of year
-    /// assert_eq!(d.iso_week().year(), 2015);
-    /// assert_eq!(d.iso_week().week(), 11);
-    /// assert_eq!(d.weekday(), Weekday::Sat);
+    /// assert_eq!(d.isoweekdate(), (2015, 11, Weekday::Sat)); // ISO week and weekday
     /// ~~~~
     ///
     /// While not directly supported by Chrono,
     /// it is easy to convert from the Julian day number
     /// (January 1, 4713 BCE in the *Julian* calendar being Day 0)
     /// to Gregorian with this method.
     /// (Note that this panics when `jd` is out of range.)
     ///
@@ -383,76 +382,69 @@ impl NaiveDate {
     ///
     /// Returns `None` on the out-of-range date.
     ///
     /// # Example
     ///
     /// ~~~~
     /// use chrono::NaiveDate;
     ///
-    /// let from_ndays_opt = NaiveDate::from_num_days_from_ce_opt;
-    /// let from_ymd = NaiveDate::from_ymd;
-    ///
-    /// assert_eq!(from_ndays_opt(730_000),      Some(from_ymd(1999, 9, 3)));
-    /// assert_eq!(from_ndays_opt(1),            Some(from_ymd(1, 1, 1)));
-    /// assert_eq!(from_ndays_opt(0),            Some(from_ymd(0, 12, 31)));
-    /// assert_eq!(from_ndays_opt(-1),           Some(from_ymd(0, 12, 30)));
-    /// assert_eq!(from_ndays_opt(100_000_000),  None);
-    /// assert_eq!(from_ndays_opt(-100_000_000), None);
+    /// let days = |ndays| NaiveDate::from_num_days_from_ce_opt(ndays);
+    /// assert_eq!(days(730000),     Some(NaiveDate::from_ymd(1999, 9, 3)));
+    /// assert_eq!(days(1),          Some(NaiveDate::from_ymd(1, 1, 1)));
+    /// assert_eq!(days(0),          Some(NaiveDate::from_ymd(0, 12, 31)));
+    /// assert_eq!(days(-1),         Some(NaiveDate::from_ymd(0, 12, 30)));
+    /// assert_eq!(days(100000000),  None);
+    /// assert_eq!(days(-100000000), None);
     /// ~~~~
     pub fn from_num_days_from_ce_opt(days: i32) -> Option<NaiveDate> {
         let days = days + 365; // make December 31, 1 BCE equal to day 0
-        let (year_div_400, cycle) = div_mod_floor(days, 146_097);
+        let (year_div_400, cycle) = div_mod_floor(days, 146097);
         let (year_mod_400, ordinal) = internals::cycle_to_yo(cycle as u32);
         let flags = YearFlags::from_year_mod_400(year_mod_400 as i32);
         NaiveDate::from_of(year_div_400 * 400 + year_mod_400 as i32,
                            Of::new(ordinal, flags))
     }
 
     /// Parses a string with the specified format string and returns a new `NaiveDate`.
-    /// See the [`format::strftime` module](../format/strftime/index.html)
+    /// See the [`format::strftime` module](../../format/strftime/index.html)
     /// on the supported escape sequences.
     ///
     /// # Example
     ///
     /// ~~~~
     /// use chrono::NaiveDate;
     ///
-    /// let parse_from_str = NaiveDate::parse_from_str;
-    ///
-    /// assert_eq!(parse_from_str("2015-09-05", "%Y-%m-%d"),
+    /// assert_eq!(NaiveDate::parse_from_str("2015-09-05", "%Y-%m-%d"),
     ///            Ok(NaiveDate::from_ymd(2015, 9, 5)));
-    /// assert_eq!(parse_from_str("5sep2015", "%d%b%Y"),
+    /// assert_eq!(NaiveDate::parse_from_str("5sep2015", "%d%b%Y"),
     ///            Ok(NaiveDate::from_ymd(2015, 9, 5)));
     /// ~~~~
     ///
     /// Time and offset is ignored for the purpose of parsing.
     ///
     /// ~~~~
     /// # use chrono::NaiveDate;
-    /// # let parse_from_str = NaiveDate::parse_from_str;
-    /// assert_eq!(parse_from_str("2014-5-17T12:34:56+09:30", "%Y-%m-%dT%H:%M:%S%z"),
+    /// assert_eq!(NaiveDate::parse_from_str("2014-5-17T12:34:56+09:30", "%Y-%m-%dT%H:%M:%S%z"),
     ///            Ok(NaiveDate::from_ymd(2014, 5, 17)));
     /// ~~~~
     ///
     /// Out-of-bound dates or insufficient fields are errors.
     ///
     /// ~~~~
     /// # use chrono::NaiveDate;
-    /// # let parse_from_str = NaiveDate::parse_from_str;
-    /// assert!(parse_from_str("2015/9", "%Y/%m").is_err());
-    /// assert!(parse_from_str("2015/9/31", "%Y/%m/%d").is_err());
+    /// assert!(NaiveDate::parse_from_str("2015/9", "%Y/%m").is_err());
+    /// assert!(NaiveDate::parse_from_str("2015/9/31", "%Y/%m/%d").is_err());
     /// ~~~~
     ///
     /// All parsed fields should be consistent to each other, otherwise it's an error.
     ///
     /// ~~~~
     /// # use chrono::NaiveDate;
-    /// # let parse_from_str = NaiveDate::parse_from_str;
-    /// assert!(parse_from_str("Sat, 09 Aug 2013", "%a, %d %b %Y").is_err());
+    /// assert!(NaiveDate::parse_from_str("Sat, 09 Aug 2013", "%a, %d %b %Y").is_err());
     /// ~~~~
     pub fn parse_from_str(s: &str, fmt: &str) -> ParseResult<NaiveDate> {
         let mut parsed = Parsed::new();
         try!(parse(&mut parsed, s, StrftimeItems::new(fmt)));
         parsed.to_naive_date()
     }
 
     /// Makes a new `NaiveDateTime` from the current date and given `NaiveTime`.
@@ -466,22 +458,22 @@ impl NaiveDate {
     /// let t = NaiveTime::from_hms_milli(12, 34, 56, 789);
     ///
     /// let dt: NaiveDateTime = d.and_time(t);
     /// assert_eq!(dt.date(), d);
     /// assert_eq!(dt.time(), t);
     /// ~~~~
     #[inline]
     pub fn and_time(&self, time: NaiveTime) -> NaiveDateTime {
-        NaiveDateTime::new(*self, time)
+        NaiveDateTime::new(self.clone(), time)
     }
 
     /// Makes a new `NaiveDateTime` from the current date, hour, minute and second.
     ///
-    /// No [leap second](./struct.NaiveTime.html#leap-second-handling) is allowed here;
+    /// No [leap second](../time/index.html#leap-second-handling) is allowed here;
     /// use `NaiveDate::and_hms_*` methods with a subsecond parameter instead.
     ///
     /// Panics on invalid hour, minute and/or second.
     ///
     /// # Example
     ///
     /// ~~~~
     /// use chrono::{NaiveDate, NaiveDateTime, Datelike, Timelike, Weekday};
@@ -495,17 +487,17 @@ impl NaiveDate {
     /// ~~~~
     #[inline]
     pub fn and_hms(&self, hour: u32, min: u32, sec: u32) -> NaiveDateTime {
         self.and_hms_opt(hour, min, sec).expect("invalid time")
     }
 
     /// Makes a new `NaiveDateTime` from the current date, hour, minute and second.
     ///
-    /// No [leap second](./struct.NaiveTime.html#leap-second-handling) is allowed here;
+    /// No [leap second](../time/index.html#leap-second-handling) is allowed here;
     /// use `NaiveDate::and_hms_*_opt` methods with a subsecond parameter instead.
     ///
     /// Returns `None` on invalid hour, minute and/or second.
     ///
     /// # Example
     ///
     /// ~~~~
     /// use chrono::NaiveDate;
@@ -519,17 +511,17 @@ impl NaiveDate {
     #[inline]
     pub fn and_hms_opt(&self, hour: u32, min: u32, sec: u32) -> Option<NaiveDateTime> {
         NaiveTime::from_hms_opt(hour, min, sec).map(|time| self.and_time(time))
     }
 
     /// Makes a new `NaiveDateTime` from the current date, hour, minute, second and millisecond.
     ///
     /// The millisecond part can exceed 1,000
-    /// in order to represent the [leap second](./struct.NaiveTime.html#leap-second-handling).
+    /// in order to represent the [leap second](../time/index.html#leap-second-handling).
     ///
     /// Panics on invalid hour, minute, second and/or millisecond.
     ///
     /// # Example
     ///
     /// ~~~~
     /// use chrono::{NaiveDate, NaiveDateTime, Datelike, Timelike, Weekday};
     ///
@@ -544,17 +536,17 @@ impl NaiveDate {
     #[inline]
     pub fn and_hms_milli(&self, hour: u32, min: u32, sec: u32, milli: u32) -> NaiveDateTime {
         self.and_hms_milli_opt(hour, min, sec, milli).expect("invalid time")
     }
 
     /// Makes a new `NaiveDateTime` from the current date, hour, minute, second and millisecond.
     ///
     /// The millisecond part can exceed 1,000
-    /// in order to represent the [leap second](./struct.NaiveTime.html#leap-second-handling).
+    /// in order to represent the [leap second](../time/index.html#leap-second-handling).
     ///
     /// Returns `None` on invalid hour, minute, second and/or millisecond.
     ///
     /// # Example
     ///
     /// ~~~~
     /// use chrono::NaiveDate;
     ///
@@ -570,17 +562,17 @@ impl NaiveDate {
     pub fn and_hms_milli_opt(&self, hour: u32, min: u32, sec: u32,
                              milli: u32) -> Option<NaiveDateTime> {
         NaiveTime::from_hms_milli_opt(hour, min, sec, milli).map(|time| self.and_time(time))
     }
 
     /// Makes a new `NaiveDateTime` from the current date, hour, minute, second and microsecond.
     ///
     /// The microsecond part can exceed 1,000,000
-    /// in order to represent the [leap second](./struct.NaiveTime.html#leap-second-handling).
+    /// in order to represent the [leap second](../time/index.html#leap-second-handling).
     ///
     /// Panics on invalid hour, minute, second and/or microsecond.
     ///
     /// # Example
     ///
     /// ~~~~
     /// use chrono::{NaiveDate, NaiveDateTime, Datelike, Timelike, Weekday};
     ///
@@ -595,17 +587,17 @@ impl NaiveDate {
     #[inline]
     pub fn and_hms_micro(&self, hour: u32, min: u32, sec: u32, micro: u32) -> NaiveDateTime {
         self.and_hms_micro_opt(hour, min, sec, micro).expect("invalid time")
     }
 
     /// Makes a new `NaiveDateTime` from the current date, hour, minute, second and microsecond.
     ///
     /// The microsecond part can exceed 1,000,000
-    /// in order to represent the [leap second](./struct.NaiveTime.html#leap-second-handling).
+    /// in order to represent the [leap second](../time/index.html#leap-second-handling).
     ///
     /// Returns `None` on invalid hour, minute, second and/or microsecond.
     ///
     /// # Example
     ///
     /// ~~~~
     /// use chrono::NaiveDate;
     ///
@@ -621,17 +613,17 @@ impl NaiveDate {
     pub fn and_hms_micro_opt(&self, hour: u32, min: u32, sec: u32,
                              micro: u32) -> Option<NaiveDateTime> {
         NaiveTime::from_hms_micro_opt(hour, min, sec, micro).map(|time| self.and_time(time))
     }
 
     /// Makes a new `NaiveDateTime` from the current date, hour, minute, second and nanosecond.
     ///
     /// The nanosecond part can exceed 1,000,000,000
-    /// in order to represent the [leap second](./struct.NaiveTime.html#leap-second-handling).
+    /// in order to represent the [leap second](../time/index.html#leap-second-handling).
     ///
     /// Panics on invalid hour, minute, second and/or nanosecond.
     ///
     /// # Example
     ///
     /// ~~~~
     /// use chrono::{NaiveDate, NaiveDateTime, Datelike, Timelike, Weekday};
     ///
@@ -646,17 +638,17 @@ impl NaiveDate {
     #[inline]
     pub fn and_hms_nano(&self, hour: u32, min: u32, sec: u32, nano: u32) -> NaiveDateTime {
         self.and_hms_nano_opt(hour, min, sec, nano).expect("invalid time")
     }
 
     /// Makes a new `NaiveDateTime` from the current date, hour, minute, second and nanosecond.
     ///
     /// The nanosecond part can exceed 1,000,000,000
-    /// in order to represent the [leap second](./struct.NaiveTime.html#leap-second-handling).
+    /// in order to represent the [leap second](../time/index.html#leap-second-handling).
     ///
     /// Returns `None` on invalid hour, minute, second and/or nanosecond.
     ///
     /// # Example
     ///
     /// ~~~~
     /// use chrono::NaiveDate;
     ///
@@ -678,17 +670,17 @@ impl NaiveDate {
     #[inline]
     fn mdf(&self) -> Mdf {
         self.of().to_mdf()
     }
 
     /// Returns the packed ordinal-flags.
     #[inline]
     fn of(&self) -> Of {
-        Of((self.ymdf & 0b1_1111_1111_1111) as u32)
+        Of((self.ymdf & 0b1111_11111_1111) as u32)
     }
 
     /// Makes a new `NaiveDate` with the packed month-day-flags changed.
     ///
     /// Returns `None` when the resulting `NaiveDate` would be invalid.
     #[inline]
     fn with_mdf(&self, mdf: Mdf) -> Option<NaiveDate> {
         self.with_of(mdf.to_of())
@@ -696,17 +688,17 @@ impl NaiveDate {
 
     /// Makes a new `NaiveDate` with the packed ordinal-flags changed.
     ///
     /// Returns `None` when the resulting `NaiveDate` would be invalid.
     #[inline]
     fn with_of(&self, of: Of) -> Option<NaiveDate> {
         if of.valid() {
             let Of(of) = of;
-            Some(NaiveDate { ymdf: (self.ymdf & !0b1_1111_1111_1111) | of as DateImpl })
+            Some(NaiveDate { ymdf: (self.ymdf & !0b111111111_1111) | of as DateImpl })
         } else {
             None
         }
     }
 
     /// Makes a new `NaiveDate` for the next calendar date.
     ///
     /// Panics when `self` is the last representable date.
@@ -728,21 +720,21 @@ impl NaiveDate {
     /// Makes a new `NaiveDate` for the next calendar date.
     ///
     /// Returns `None` when `self` is the last representable date.
     ///
     /// # Example
     ///
     /// ~~~~
     /// use chrono::NaiveDate;
-    /// use chrono::naive::MAX_DATE;
+    /// use chrono::naive::date::MAX;
     ///
     /// assert_eq!(NaiveDate::from_ymd(2015, 6, 3).succ_opt(),
     ///            Some(NaiveDate::from_ymd(2015, 6, 4)));
-    /// assert_eq!(MAX_DATE.succ_opt(), None);
+    /// assert_eq!(MAX.succ_opt(), None);
     /// ~~~~
     #[inline]
     pub fn succ_opt(&self) -> Option<NaiveDate> {
         self.with_of(self.of().succ()).or_else(|| NaiveDate::from_ymd_opt(self.year() + 1, 1, 1))
     }
 
     /// Makes a new `NaiveDate` for the previous calendar date.
     ///
@@ -765,170 +757,114 @@ impl NaiveDate {
     /// Makes a new `NaiveDate` for the previous calendar date.
     ///
     /// Returns `None` when `self` is the first representable date.
     ///
     /// # Example
     ///
     /// ~~~~
     /// use chrono::NaiveDate;
-    /// use chrono::naive::MIN_DATE;
+    /// use chrono::naive::date::MIN;
     ///
     /// assert_eq!(NaiveDate::from_ymd(2015, 6, 3).pred_opt(),
     ///            Some(NaiveDate::from_ymd(2015, 6, 2)));
-    /// assert_eq!(MIN_DATE.pred_opt(), None);
+    /// assert_eq!(MIN.pred_opt(), None);
     /// ~~~~
     #[inline]
     pub fn pred_opt(&self) -> Option<NaiveDate> {
         self.with_of(self.of().pred()).or_else(|| NaiveDate::from_ymd_opt(self.year() - 1, 12, 31))
     }
 
     /// Adds the `days` part of given `Duration` to the current date.
     ///
     /// Returns `None` when it will result in overflow.
     ///
     /// # Example
     ///
     /// ~~~~
-    /// # extern crate chrono; extern crate time; fn main() {
-    /// use chrono::NaiveDate;
-    /// use chrono::naive::MAX_DATE;
-    /// use time::Duration;
+    /// use chrono::{NaiveDate, Duration};
+    /// use chrono::naive::date::MAX;
     ///
     /// let d = NaiveDate::from_ymd(2015, 9, 5);
-    /// assert_eq!(d.checked_add_signed(Duration::days(40)),
-    ///            Some(NaiveDate::from_ymd(2015, 10, 15)));
-    /// assert_eq!(d.checked_add_signed(Duration::days(-40)),
-    ///            Some(NaiveDate::from_ymd(2015, 7, 27)));
-    /// assert_eq!(d.checked_add_signed(Duration::days(1_000_000_000)), None);
-    /// assert_eq!(d.checked_add_signed(Duration::days(-1_000_000_000)), None);
-    /// assert_eq!(MAX_DATE.checked_add_signed(Duration::days(1)), None);
-    /// # }
+    /// assert_eq!(d.checked_add(Duration::days(40)), Some(NaiveDate::from_ymd(2015, 10, 15)));
+    /// assert_eq!(d.checked_add(Duration::days(-40)), Some(NaiveDate::from_ymd(2015, 7, 27)));
+    /// assert_eq!(d.checked_add(Duration::days(1000_000_000)), None);
+    /// assert_eq!(d.checked_add(Duration::days(-1000_000_000)), None);
+    /// assert_eq!(MAX.checked_add(Duration::days(1)), None);
     /// ~~~~
-    pub fn checked_add_signed(self, rhs: OldDuration) -> Option<NaiveDate> {
+    pub fn checked_add(self, rhs: Duration) -> Option<NaiveDate> {
         let year = self.year();
         let (mut year_div_400, year_mod_400) = div_mod_floor(year, 400);
         let cycle = internals::yo_to_cycle(year_mod_400 as u32, self.of().ordinal());
         let cycle = try_opt!((cycle as i32).checked_add(try_opt!(rhs.num_days().to_i32())));
-        let (cycle_div_400y, cycle) = div_mod_floor(cycle, 146_097);
+        let (cycle_div_400y, cycle) = div_mod_floor(cycle, 146097);
         year_div_400 += cycle_div_400y;
 
         let (year_mod_400, ordinal) = internals::cycle_to_yo(cycle as u32);
         let flags = YearFlags::from_year_mod_400(year_mod_400 as i32);
         NaiveDate::from_of(year_div_400 * 400 + year_mod_400 as i32,
                            Of::new(ordinal, flags))
     }
 
     /// Subtracts the `days` part of given `Duration` from the current date.
     ///
     /// Returns `None` when it will result in overflow.
     ///
     /// # Example
     ///
     /// ~~~~
-    /// # extern crate chrono; extern crate time; fn main() {
-    /// use chrono::NaiveDate;
-    /// use chrono::naive::MIN_DATE;
-    /// use time::Duration;
+    /// use chrono::{NaiveDate, Duration};
+    /// use chrono::naive::date::MIN;
     ///
     /// let d = NaiveDate::from_ymd(2015, 9, 5);
-    /// assert_eq!(d.checked_sub_signed(Duration::days(40)),
-    ///            Some(NaiveDate::from_ymd(2015, 7, 27)));
-    /// assert_eq!(d.checked_sub_signed(Duration::days(-40)),
-    ///            Some(NaiveDate::from_ymd(2015, 10, 15)));
-    /// assert_eq!(d.checked_sub_signed(Duration::days(1_000_000_000)), None);
-    /// assert_eq!(d.checked_sub_signed(Duration::days(-1_000_000_000)), None);
-    /// assert_eq!(MIN_DATE.checked_sub_signed(Duration::days(1)), None);
-    /// # }
+    /// assert_eq!(d.checked_sub(Duration::days(40)), Some(NaiveDate::from_ymd(2015, 7, 27)));
+    /// assert_eq!(d.checked_sub(Duration::days(-40)), Some(NaiveDate::from_ymd(2015, 10, 15)));
+    /// assert_eq!(d.checked_sub(Duration::days(1000_000_000)), None);
+    /// assert_eq!(d.checked_sub(Duration::days(-1000_000_000)), None);
+    /// assert_eq!(MIN.checked_sub(Duration::days(1)), None);
     /// ~~~~
-    pub fn checked_sub_signed(self, rhs: OldDuration) -> Option<NaiveDate> {
+    pub fn checked_sub(self, rhs: Duration) -> Option<NaiveDate> {
         let year = self.year();
         let (mut year_div_400, year_mod_400) = div_mod_floor(year, 400);
         let cycle = internals::yo_to_cycle(year_mod_400 as u32, self.of().ordinal());
         let cycle = try_opt!((cycle as i32).checked_sub(try_opt!(rhs.num_days().to_i32())));
-        let (cycle_div_400y, cycle) = div_mod_floor(cycle, 146_097);
+        let (cycle_div_400y, cycle) = div_mod_floor(cycle, 146097);
         year_div_400 += cycle_div_400y;
 
         let (year_mod_400, ordinal) = internals::cycle_to_yo(cycle as u32);
         let flags = YearFlags::from_year_mod_400(year_mod_400 as i32);
         NaiveDate::from_of(year_div_400 * 400 + year_mod_400 as i32,
                            Of::new(ordinal, flags))
     }
 
-    /// Subtracts another `NaiveDate` from the current date.
-    /// Returns a `Duration` of integral numbers.
-    ///
-    /// This does not overflow or underflow at all,
-    /// as all possible output fits in the range of `Duration`.
-    ///
-    /// # Example
-    ///
-    /// ~~~~
-    /// # extern crate chrono; extern crate time; fn main() {
-    /// use chrono::NaiveDate;
-    /// use time::Duration;
-    ///
-    /// let from_ymd = NaiveDate::from_ymd;
-    /// let since = NaiveDate::signed_duration_since;
-    ///
-    /// assert_eq!(since(from_ymd(2014, 1, 1), from_ymd(2014, 1, 1)), Duration::zero());
-    /// assert_eq!(since(from_ymd(2014, 1, 1), from_ymd(2013, 12, 31)), Duration::days(1));
-    /// assert_eq!(since(from_ymd(2014, 1, 1), from_ymd(2014, 1, 2)), Duration::days(-1));
-    /// assert_eq!(since(from_ymd(2014, 1, 1), from_ymd(2013, 9, 23)), Duration::days(100));
-    /// assert_eq!(since(from_ymd(2014, 1, 1), from_ymd(2013, 1, 1)), Duration::days(365));
-    /// assert_eq!(since(from_ymd(2014, 1, 1), from_ymd(2010, 1, 1)), Duration::days(365*4 + 1));
-    /// assert_eq!(since(from_ymd(2014, 1, 1), from_ymd(1614, 1, 1)), Duration::days(365*400 + 97));
-    /// # }
-    /// ~~~~
-    pub fn signed_duration_since(self, rhs: NaiveDate) -> OldDuration {
-        let year1 = self.year();
-        let year2 = rhs.year();
-        let (year1_div_400, year1_mod_400) = div_mod_floor(year1, 400);
-        let (year2_div_400, year2_mod_400) = div_mod_floor(year2, 400);
-        let cycle1 = i64::from(internals::yo_to_cycle(year1_mod_400 as u32, self.of().ordinal()));
-        let cycle2 = i64::from(internals::yo_to_cycle(year2_mod_400 as u32, rhs.of().ordinal()));
-        OldDuration::days((i64::from(year1_div_400) - i64::from(year2_div_400)) * 146_097 +
-                          (cycle1 - cycle2))
-    }
-
     /// Formats the date with the specified formatting items.
     /// Otherwise it is same to the ordinary `format` method.
     ///
     /// The `Iterator` of items should be `Clone`able,
     /// since the resulting `DelayedFormat` value may be formatted multiple times.
     ///
     /// # Example
     ///
     /// ~~~~
     /// use chrono::NaiveDate;
     /// use chrono::format::strftime::StrftimeItems;
     ///
     /// let fmt = StrftimeItems::new("%Y-%m-%d");
     /// let d = NaiveDate::from_ymd(2015, 9, 5);
     /// assert_eq!(d.format_with_items(fmt.clone()).to_string(), "2015-09-05");
-    /// assert_eq!(d.format("%Y-%m-%d").to_string(),             "2015-09-05");
-    /// ~~~~
-    ///
-    /// The resulting `DelayedFormat` can be formatted directly via the `Display` trait.
-    ///
-    /// ~~~~
-    /// # use chrono::NaiveDate;
-    /// # use chrono::format::strftime::StrftimeItems;
-    /// # let fmt = StrftimeItems::new("%Y-%m-%d").clone();
-    /// # let d = NaiveDate::from_ymd(2015, 9, 5);
-    /// assert_eq!(format!("{}", d.format_with_items(fmt)), "2015-09-05");
+    /// assert_eq!(d.format("%Y-%m-%d").to_string(), "2015-09-05");
     /// ~~~~
     #[inline]
     pub fn format_with_items<'a, I>(&self, items: I) -> DelayedFormat<I>
             where I: Iterator<Item=Item<'a>> + Clone {
-        DelayedFormat::new(Some(*self), None, items)
+        DelayedFormat::new(Some(self.clone()), None, items)
     }
 
     /// Formats the date with the specified format string.
-    /// See the [`format::strftime` module](../format/strftime/index.html)
+    /// See the [`format::strftime` module](../../format/strftime/index.html)
     /// on the supported escape sequences.
     ///
     /// This returns a `DelayedFormat`,
     /// which gets converted to a string only when actual formatting happens.
     /// You may use the `to_string` method to get a `String`,
     /// or just feed it into `print!` and other formatting macros.
     /// (In this way it avoids the redundant memory allocation.)
     ///
@@ -940,33 +876,24 @@ impl NaiveDate {
     ///
     /// ~~~~
     /// use chrono::NaiveDate;
     ///
     /// let d = NaiveDate::from_ymd(2015, 9, 5);
     /// assert_eq!(d.format("%Y-%m-%d").to_string(), "2015-09-05");
     /// assert_eq!(d.format("%A, %-d %B, %C%y").to_string(), "Saturday, 5 September, 2015");
     /// ~~~~
-    ///
-    /// The resulting `DelayedFormat` can be formatted directly via the `Display` trait.
-    ///
-    /// ~~~~
-    /// # use chrono::NaiveDate;
-    /// # let d = NaiveDate::from_ymd(2015, 9, 5);
-    /// assert_eq!(format!("{}", d.format("%Y-%m-%d")), "2015-09-05");
-    /// assert_eq!(format!("{}", d.format("%A, %-d %B, %C%y")), "Saturday, 5 September, 2015");
-    /// ~~~~
     #[inline]
     pub fn format<'a>(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>> {
         self.format_with_items(StrftimeItems::new(fmt))
     }
 }
 
 impl Datelike for NaiveDate {
-    /// Returns the year number in the [calendar date](#calendar-date).
+    /// Returns the year number in the [calendar date](./index.html#calendar-date).
     ///
     /// # Example
     ///
     /// ~~~~
     /// use chrono::{NaiveDate, Datelike};
     ///
     /// assert_eq!(NaiveDate::from_ymd(2015, 9, 8).year(), 2015);
     /// assert_eq!(NaiveDate::from_ymd(-308, 3, 14).year(), -308); // 309 BCE
@@ -1018,17 +945,17 @@ impl Datelike for NaiveDate {
     ///
     /// ~~~~
     /// use chrono::{NaiveDate, Datelike};
     ///
     /// assert_eq!(NaiveDate::from_ymd(2015, 9, 8).day(), 8);
     /// assert_eq!(NaiveDate::from_ymd(-308, 3, 14).day(), 14);
     /// ~~~~
     ///
-    /// Combined with [`NaiveDate::pred`](#method.pred),
+    /// Combined with [`NaiveDate::pred`](./struct.NaiveDate.html#method.pred),
     /// one can determine the number of days in a particular month.
     /// (Note that this panics when `year` is out of range.)
     ///
     /// ~~~~
     /// use chrono::{NaiveDate, Datelike};
     ///
     /// fn ndays_in_month(year: i32, month: u32) -> u32 {
     ///     // the first day of the next month...
@@ -1075,17 +1002,17 @@ impl Datelike for NaiveDate {
     ///
     /// ~~~~
     /// use chrono::{NaiveDate, Datelike};
     ///
     /// assert_eq!(NaiveDate::from_ymd(2015, 9, 8).ordinal(), 251);
     /// assert_eq!(NaiveDate::from_ymd(-308, 3, 14).ordinal(), 74);
     /// ~~~~
     ///
-    /// Combined with [`NaiveDate::pred`](#method.pred),
+    /// Combined with [`NaiveDate::pred`](./struct.NaiveDate.html#method.pred),
     /// one can determine the number of days in a particular year.
     /// (Note that this panics when `year` is out of range.)
     ///
     /// ~~~~
     /// use chrono::{NaiveDate, Datelike};
     ///
     /// fn ndays_in_year(year: i32) -> u32 {
     ///     // the first day of the next year...
@@ -1133,19 +1060,31 @@ impl Datelike for NaiveDate {
     /// assert_eq!(NaiveDate::from_ymd(2015, 9, 8).weekday(), Weekday::Tue);
     /// assert_eq!(NaiveDate::from_ymd(-308, 3, 14).weekday(), Weekday::Fri);
     /// ~~~~
     #[inline]
     fn weekday(&self) -> Weekday {
         self.of().weekday()
     }
 
-    #[inline]
-    fn iso_week(&self) -> IsoWeek {
-        isoweek::iso_week_from_yof(self.year(), self.of())
+    fn isoweekdate(&self) -> (i32, u32, Weekday) {
+        let of = self.of();
+        let year = self.year();
+        let (rawweek, weekday) = of.isoweekdate_raw();
+        if rawweek < 1 { // previous year
+            let prevlastweek = YearFlags::from_year(year - 1).nisoweeks();
+            (year - 1, prevlastweek, weekday)
+        } else {
+            let lastweek = of.flags().nisoweeks();
+            if rawweek > lastweek { // next year
+                (year + 1, 1, weekday)
+            } else {
+                (year, rawweek, weekday)
+            }
+        }
     }
 
     /// Makes a new `NaiveDate` with the year number changed.
     ///
     /// Returns `None` when the resulting `NaiveDate` would be invalid.
     ///
     /// # Example
     ///
@@ -1297,137 +1236,118 @@ impl Datelike for NaiveDate {
     ///            Some(NaiveDate::from_ymd(2016, 12, 31)));
     /// ~~~~
     #[inline]
     fn with_ordinal0(&self, ordinal0: u32) -> Option<NaiveDate> {
         self.with_of(self.of().with_ordinal(ordinal0 + 1))
     }
 }
 
+/// `NaiveDate` can be used as a key to the hash maps.
+impl hash::Hash for NaiveDate {
+    fn hash<H: hash::Hasher>(&self, state: &mut H) {
+        // don't need to strip flags, as we can safely assume that it is correct
+        self.ymdf.hash(state);
+    }
+}
+
 /// An addition of `Duration` to `NaiveDate` discards the fractional days,
 /// rounding to the closest integral number of days towards `Duration::zero()`.
 ///
 /// Panics on underflow or overflow.
-/// Use [`NaiveDate::checked_add_signed`](#method.checked_add_signed) to detect that.
+/// Use [`NaiveDate::checked_add`](#method.checked_add) to detect that.
 ///
 /// # Example
 ///
 /// ~~~~
-/// # extern crate chrono; extern crate time; fn main() {
-/// use chrono::NaiveDate;
-/// use time::Duration;
-///
-/// let from_ymd = NaiveDate::from_ymd;
+/// use chrono::{NaiveDate, Duration};
 ///
-/// assert_eq!(from_ymd(2014, 1, 1) + Duration::zero(),             from_ymd(2014, 1, 1));
-/// assert_eq!(from_ymd(2014, 1, 1) + Duration::seconds(86399),     from_ymd(2014, 1, 1));
-/// assert_eq!(from_ymd(2014, 1, 1) + Duration::seconds(-86399),    from_ymd(2014, 1, 1));
-/// assert_eq!(from_ymd(2014, 1, 1) + Duration::days(1),            from_ymd(2014, 1, 2));
-/// assert_eq!(from_ymd(2014, 1, 1) + Duration::days(-1),           from_ymd(2013, 12, 31));
-/// assert_eq!(from_ymd(2014, 1, 1) + Duration::days(364),          from_ymd(2014, 12, 31));
-/// assert_eq!(from_ymd(2014, 1, 1) + Duration::days(365*4 + 1),    from_ymd(2018, 1, 1));
-/// assert_eq!(from_ymd(2014, 1, 1) + Duration::days(365*400 + 97), from_ymd(2414, 1, 1));
-/// # }
+/// let ymd = |y,m,d| NaiveDate::from_ymd(y, m, d);
+/// assert_eq!(ymd(2014, 1, 1) + Duration::zero(),             ymd(2014, 1, 1));
+/// assert_eq!(ymd(2014, 1, 1) + Duration::seconds(86399),     ymd(2014, 1, 1));
+/// assert_eq!(ymd(2014, 1, 1) + Duration::seconds(-86399),    ymd(2014, 1, 1));
+/// assert_eq!(ymd(2014, 1, 1) + Duration::days(1),            ymd(2014, 1, 2));
+/// assert_eq!(ymd(2014, 1, 1) + Duration::days(-1),           ymd(2013, 12, 31));
+/// assert_eq!(ymd(2014, 1, 1) + Duration::days(364),          ymd(2014, 12, 31));
+/// assert_eq!(ymd(2014, 1, 1) + Duration::days(365*4 + 1),    ymd(2018, 1, 1));
+/// assert_eq!(ymd(2014, 1, 1) + Duration::days(365*400 + 97), ymd(2414, 1, 1));
 /// ~~~~
-impl Add<OldDuration> for NaiveDate {
+impl Add<Duration> for NaiveDate {
     type Output = NaiveDate;
 
     #[inline]
-    fn add(self, rhs: OldDuration) -> NaiveDate {
-        self.checked_add_signed(rhs).expect("`NaiveDate + Duration` overflowed")
+    fn add(self, rhs: Duration) -> NaiveDate {
+        self.checked_add(rhs).expect("`NaiveDate + Duration` overflowed")
     }
 }
 
-impl AddAssign<OldDuration> for NaiveDate {
-    #[inline]
-    fn add_assign(&mut self, rhs: OldDuration) {
-        *self = self.add(rhs);
+/// A subtraction of `NaiveDate` from `NaiveDate` yields a `Duration` of integral numbers.
+///
+/// This does not overflow or underflow at all,
+/// as all possible output fits in the range of `Duration`.
+///
+/// # Example
+///
+/// ~~~~
+/// use chrono::{NaiveDate, Duration};
+///
+/// let ymd = |y,m,d| NaiveDate::from_ymd(y, m, d);
+/// assert_eq!(ymd(2014, 1, 1) - ymd(2014, 1, 1),   Duration::zero());
+/// assert_eq!(ymd(2014, 1, 1) - ymd(2013, 12, 31), Duration::days(1));
+/// assert_eq!(ymd(2014, 1, 1) - ymd(2014, 1, 2),   Duration::days(-1));
+/// assert_eq!(ymd(2014, 1, 1) - ymd(2013, 9, 23),  Duration::days(100));
+/// assert_eq!(ymd(2014, 1, 1) - ymd(2013, 1, 1),   Duration::days(365));
+/// assert_eq!(ymd(2014, 1, 1) - ymd(2010, 1, 1),   Duration::days(365*4 + 1));
+/// assert_eq!(ymd(2014, 1, 1) - ymd(1614, 1, 1),   Duration::days(365*400 + 97));
+/// ~~~~
+impl Sub<NaiveDate> for NaiveDate {
+    type Output = Duration;
+
+    fn sub(self, rhs: NaiveDate) -> Duration {
+        let year1 = self.year();
+        let year2 = rhs.year();
+        let (year1_div_400, year1_mod_400) = div_mod_floor(year1, 400);
+        let (year2_div_400, year2_mod_400) = div_mod_floor(year2, 400);
+        let cycle1 = internals::yo_to_cycle(year1_mod_400 as u32, self.of().ordinal()) as i64;
+        let cycle2 = internals::yo_to_cycle(year2_mod_400 as u32, rhs.of().ordinal()) as i64;
+        Duration::days((year1_div_400 as i64 - year2_div_400 as i64) * 146097 + (cycle1 - cycle2))
     }
 }
 
 /// A subtraction of `Duration` from `NaiveDate` discards the fractional days,
 /// rounding to the closest integral number of days towards `Duration::zero()`.
-/// It is same to the addition with a negated `Duration`.
 ///
 /// Panics on underflow or overflow.
-/// Use [`NaiveDate::checked_sub_signed`](#method.checked_sub_signed) to detect that.
+/// Use [`NaiveDate::checked_sub`](#method.checked_sub) to detect that.
 ///
 /// # Example
 ///
 /// ~~~~
-/// # extern crate chrono; extern crate time; fn main() {
-/// use chrono::NaiveDate;
-/// use time::Duration;
-///
-/// let from_ymd = NaiveDate::from_ymd;
+/// use chrono::{NaiveDate, Duration};
 ///
-/// assert_eq!(from_ymd(2014, 1, 1) - Duration::zero(),             from_ymd(2014, 1, 1));
-/// assert_eq!(from_ymd(2014, 1, 1) - Duration::seconds(86399),     from_ymd(2014, 1, 1));
-/// assert_eq!(from_ymd(2014, 1, 1) - Duration::seconds(-86399),    from_ymd(2014, 1, 1));
-/// assert_eq!(from_ymd(2014, 1, 1) - Duration::days(1),            from_ymd(2013, 12, 31));
-/// assert_eq!(from_ymd(2014, 1, 1) - Duration::days(-1),           from_ymd(2014, 1, 2));
-/// assert_eq!(from_ymd(2014, 1, 1) - Duration::days(364),          from_ymd(2013, 1, 2));
-/// assert_eq!(from_ymd(2014, 1, 1) - Duration::days(365*4 + 1),    from_ymd(2010, 1, 1));
-/// assert_eq!(from_ymd(2014, 1, 1) - Duration::days(365*400 + 97), from_ymd(1614, 1, 1));
-/// # }
+/// let ymd = |y,m,d| NaiveDate::from_ymd(y, m, d);
+/// assert_eq!(ymd(2014, 1, 1) - Duration::zero(),             ymd(2014, 1, 1));
+/// assert_eq!(ymd(2014, 1, 1) - Duration::seconds(86399),     ymd(2014, 1, 1));
+/// assert_eq!(ymd(2014, 1, 1) - Duration::seconds(-86399),    ymd(2014, 1, 1));
+/// assert_eq!(ymd(2014, 1, 1) - Duration::days(1),            ymd(2013, 12, 31));
+/// assert_eq!(ymd(2014, 1, 1) - Duration::days(-1),           ymd(2014, 1, 2));
+/// assert_eq!(ymd(2014, 1, 1) - Duration::days(364),          ymd(2013, 1, 2));
+/// assert_eq!(ymd(2014, 1, 1) - Duration::days(365*4 + 1),    ymd(2010, 1, 1));
+/// assert_eq!(ymd(2014, 1, 1) - Duration::days(365*400 + 97), ymd(1614, 1, 1));
 /// ~~~~
-impl Sub<OldDuration> for NaiveDate {
+impl Sub<Duration> for NaiveDate {
     type Output = NaiveDate;
 
     #[inline]
-    fn sub(self, rhs: OldDuration) -> NaiveDate {
-        self.checked_sub_signed(rhs).expect("`NaiveDate - Duration` overflowed")
-    }
-}
-
-impl SubAssign<OldDuration> for NaiveDate {
-    #[inline]
-    fn sub_assign(&mut self, rhs: OldDuration) {
-        *self = self.sub(rhs);
+    fn sub(self, rhs: Duration) -> NaiveDate {
+        self.checked_sub(rhs).expect("`NaiveDate - Duration` overflowed")
     }
 }
 
-/// Subtracts another `NaiveDate` from the current date.
-/// Returns a `Duration` of integral numbers.
-/// 
-/// This does not overflow or underflow at all,
-/// as all possible output fits in the range of `Duration`.
-///
-/// The implementation is a wrapper around
-/// [`NaiveDate::signed_duration_since`](#method.signed_duration_since).
-///
-/// # Example
-///
-/// ~~~~
-/// # extern crate chrono; extern crate time; fn main() {
-/// use chrono::NaiveDate;
-/// use time::Duration;
-///
-/// let from_ymd = NaiveDate::from_ymd;
-///
-/// assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2014, 1, 1), Duration::zero());
-/// assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2013, 12, 31), Duration::days(1));
-/// assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2014, 1, 2), Duration::days(-1));
-/// assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2013, 9, 23), Duration::days(100));
-/// assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2013, 1, 1), Duration::days(365));
-/// assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2010, 1, 1), Duration::days(365*4 + 1));
-/// assert_eq!(from_ymd(2014, 1, 1) - from_ymd(1614, 1, 1), Duration::days(365*400 + 97));
-/// # }
-/// ~~~~
-impl Sub<NaiveDate> for NaiveDate {
-    type Output = OldDuration;
-
-    #[inline]
-    fn sub(self, rhs: NaiveDate) -> OldDuration {
-        self.signed_duration_since(rhs)
-    }
-}
-
-/// The `Debug` output of the naive date `d` is same to
-/// [`d.format("%Y-%m-%d")`](../format/strftime/index.html).
+/// The `Debug` output of the naive date `d` is same to `d.format("%Y-%m-%d")`.
 ///
 /// The string printed can be readily parsed via the `parse` method on `str`.
 ///
 /// # Example
 ///
 /// ~~~~
 /// use chrono::NaiveDate;
 ///
@@ -1451,18 +1371,17 @@ impl fmt::Debug for NaiveDate {
             write!(f, "{:04}-{:02}-{:02}", year, mdf.month(), mdf.day())
         } else {
             // ISO 8601 requires the explicit sign for out-of-range years
             write!(f, "{:+05}-{:02}-{:02}", year, mdf.month(), mdf.day())
         }
     }
 }
 
-/// The `Display` output of the naive date `d` is same to
-/// [`d.format("%Y-%m-%d")`](../format/strftime/index.html).
+/// The `Display` output of the naive date `d` is same to `d.format("%Y-%m-%d")`.
 ///
 /// The string printed can be readily parsed via the `parse` method on `str`.
 ///
 /// # Example
 ///
 /// ~~~~
 /// use chrono::NaiveDate;
 ///
@@ -1477,29 +1396,28 @@ impl fmt::Debug for NaiveDate {
 /// # use chrono::NaiveDate;
 /// assert_eq!(format!("{}", NaiveDate::from_ymd(   -1,  1,  1)),  "-0001-01-01");
 /// assert_eq!(format!("{}", NaiveDate::from_ymd(10000, 12, 31)), "+10000-12-31");
 /// ~~~~
 impl fmt::Display for NaiveDate {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Debug::fmt(self, f) }
 }
 
-/// Parsing a `str` into a `NaiveDate` uses the same format,
-/// [`%Y-%m-%d`](../format/strftime/index.html), as in `Debug` and `Display`.
+/// Parsing a str into a `NaiveDate` uses the same format, `%Y-%m-%d`, as `Debug` and `Display`.
 ///
 /// # Example
 ///
 /// ~~~~
 /// use chrono::NaiveDate;
 ///
 /// let d = NaiveDate::from_ymd(2015, 9, 18);
-/// assert_eq!("2015-09-18".parse::<NaiveDate>(), Ok(d));
+/// assert_eq!(format!("{}", d).parse::<NaiveDate>(), Ok(d));
 ///
 /// let d = NaiveDate::from_ymd(12345, 6, 7);
-/// assert_eq!("+12345-6-7".parse::<NaiveDate>(), Ok(d));
+/// assert_eq!(format!("{}", d).parse::<NaiveDate>(), Ok(d));
 ///
 /// assert!("foo".parse::<NaiveDate>().is_err());
 /// ~~~~
 impl str::FromStr for NaiveDate {
     type Err = ParseError;
 
     fn from_str(s: &str) -> ParseResult<NaiveDate> {
         const ITEMS: &'static [Item<'static>] = &[
@@ -1512,182 +1430,193 @@ impl str::FromStr for NaiveDate {
         ];
 
         let mut parsed = Parsed::new();
         try!(parse(&mut parsed, s, ITEMS.iter().cloned()));
         parsed.to_naive_date()
     }
 }
 
-#[cfg(all(test, any(feature = "rustc-serialize", feature = "serde")))]
-fn test_encodable_json<F, E>(to_string: F)
-    where F: Fn(&NaiveDate) -> Result<String, E>, E: ::std::fmt::Debug
-{
-    assert_eq!(to_string(&NaiveDate::from_ymd(2014, 7, 24)).ok(),
-               Some(r#""2014-07-24""#.into()));
-    assert_eq!(to_string(&NaiveDate::from_ymd(0, 1, 1)).ok(),
-               Some(r#""0000-01-01""#.into()));
-    assert_eq!(to_string(&NaiveDate::from_ymd(-1, 12, 31)).ok(),
-               Some(r#""-0001-12-31""#.into()));
-    assert_eq!(to_string(&MIN_DATE).ok(),
-               Some(r#""-262144-01-01""#.into()));
-    assert_eq!(to_string(&MAX_DATE).ok(),
-               Some(r#""+262143-12-31""#.into()));
-}
-
-#[cfg(all(test, any(feature = "rustc-serialize", feature = "serde")))]
-fn test_decodable_json<F, E>(from_str: F)
-    where F: Fn(&str) -> Result<NaiveDate, E>, E: ::std::fmt::Debug
-{
-    use std::{i32, i64};
-
-    assert_eq!(from_str(r#""2016-07-08""#).ok(), Some(NaiveDate::from_ymd(2016, 7, 8)));
-    assert_eq!(from_str(r#""2016-7-8""#).ok(), Some(NaiveDate::from_ymd(2016, 7, 8)));
-    assert_eq!(from_str(r#""+002016-07-08""#).ok(), Some(NaiveDate::from_ymd(2016, 7, 8)));
-    assert_eq!(from_str(r#""0000-01-01""#).ok(), Some(NaiveDate::from_ymd(0, 1, 1)));
-    assert_eq!(from_str(r#""0-1-1""#).ok(), Some(NaiveDate::from_ymd(0, 1, 1)));
-    assert_eq!(from_str(r#""-0001-12-31""#).ok(), Some(NaiveDate::from_ymd(-1, 12, 31)));
-    assert_eq!(from_str(r#""-262144-01-01""#).ok(), Some(MIN_DATE));
-    assert_eq!(from_str(r#""+262143-12-31""#).ok(), Some(MAX_DATE));
-
-    // bad formats
-    assert!(from_str(r#""""#).is_err());
-    assert!(from_str(r#""20001231""#).is_err());
-    assert!(from_str(r#""2000-00-00""#).is_err());
-    assert!(from_str(r#""2000-02-30""#).is_err());
-    assert!(from_str(r#""2001-02-29""#).is_err());
-    assert!(from_str(r#""2002-002-28""#).is_err());
-    assert!(from_str(r#""yyyy-mm-dd""#).is_err());
-    assert!(from_str(r#"0"#).is_err());
-    assert!(from_str(r#"20.01"#).is_err());
-    assert!(from_str(&i32::MIN.to_string()).is_err());
-    assert!(from_str(&i32::MAX.to_string()).is_err());
-    assert!(from_str(&i64::MIN.to_string()).is_err());
-    assert!(from_str(&i64::MAX.to_string()).is_err());
-    assert!(from_str(r#"{}"#).is_err());
-    // pre-0.3.0 rustc-serialize format is now invalid
-    assert!(from_str(r#"{"ymdf":20}"#).is_err());
-    assert!(from_str(r#"null"#).is_err());
-}
-
 #[cfg(feature = "rustc-serialize")]
 mod rustc_serialize {
     use super::NaiveDate;
     use rustc_serialize::{Encodable, Encoder, Decodable, Decoder};
 
+    // TODO the current serialization format is NEVER intentionally defined.
+    // this basically follows the automatically generated implementation for those traits,
+    // plus manual verification steps for avoiding security problem.
+    // in the future it is likely to be redefined to more sane and reasonable format.
+
     impl Encodable for NaiveDate {
         fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
-            format!("{:?}", self).encode(s)
+            let ymdf = self.to_serialized();
+            s.emit_struct("NaiveDate", 1, |s| {
+                try!(s.emit_struct_field("ymdf", 0, |s| ymdf.encode(s)));
+                Ok(())
+            })
         }
     }
 
     impl Decodable for NaiveDate {
         fn decode<D: Decoder>(d: &mut D) -> Result<NaiveDate, D::Error> {
-            d.read_str()?.parse().map_err(|_| d.error("invalid date"))
+            d.read_struct("NaiveDate", 1, |d| {
+                let ymdf = try!(d.read_struct_field("ymdf", 0, Decodable::decode));
+                NaiveDate::from_serialized(ymdf).ok_or_else(|| d.error("invalid date"))
+            })
         }
     }
 
-    #[cfg(test)] use rustc_serialize::json;
-
     #[test]
     fn test_encodable() {
-        super::test_encodable_json(json::encode);
+        use rustc_serialize::json::encode;
+
+        assert_eq!(encode(&NaiveDate::from_ymd(2016, 7, 8)).ok(),
+                   Some(r#"{"ymdf":16518115}"#.into()));
+        assert_eq!(encode(&NaiveDate::from_ymd(0, 1, 1)).ok(),
+                   Some(r#"{"ymdf":20}"#.into()));
+        assert_eq!(encode(&NaiveDate::from_ymd(-1, 12, 31)).ok(),
+                   Some(r#"{"ymdf":-2341}"#.into()));
+        assert_eq!(encode(&super::MIN).ok(),
+                   Some(r#"{"ymdf":-2147483625}"#.into()));
+        assert_eq!(encode(&super::MAX).ok(),
+                   Some(r#"{"ymdf":2147481311}"#.into()));
     }
 
     #[test]
     fn test_decodable() {
-        super::test_decodable_json(json::decode);
+        use rustc_serialize::json;
+        use std::{i32, i64};
+
+        let decode = |s: &str| json::decode::<NaiveDate>(s);
+
+        assert_eq!(decode(r#"{"ymdf":16518115}"#).ok(), Some(NaiveDate::from_ymd(2016, 7, 8)));
+        assert_eq!(decode(r#"{"ymdf":20}"#).ok(), Some(NaiveDate::from_ymd(0, 1, 1)));
+        assert_eq!(decode(r#"{"ymdf":-2341}"#).ok(), Some(NaiveDate::from_ymd(-1, 12, 31)));
+        assert_eq!(decode(r#"{"ymdf":-2147483625}"#).ok(), Some(super::MIN));
+        assert_eq!(decode(r#"{"ymdf":2147481311}"#).ok(), Some(super::MAX));
+
+        // some extreme values and zero are always invalid
+        assert!(decode(r#"{"ymdf":0}"#).is_err());
+        assert!(decode(r#"{"ymdf":1}"#).is_err());
+        assert!(decode(r#"{"ymdf":-1}"#).is_err());
+        assert!(decode(&format!(r#"{{"ymdf":{}}}"#, i32::MIN)).is_err());
+        assert!(decode(&format!(r#"{{"ymdf":{}}}"#, i32::MAX)).is_err());
+        assert!(decode(&format!(r#"{{"ymdf":{}}}"#, i64::MIN)).is_err());
+        assert!(decode(&format!(r#"{{"ymdf":{}}}"#, i64::MAX)).is_err());
+
+        // bad formats
+        assert!(decode(r#"{"ymdf":20.01}"#).is_err());
+        assert!(decode(r#"{"ymdf":"string"}"#).is_err());
+        assert!(decode(r#"{"ymdf":null}"#).is_err());
+        assert!(decode(r#"{}"#).is_err());
+        assert!(decode(r#"{"date":20}"#).is_err());
+        assert!(decode(r#"20"#).is_err());
+        assert!(decode(r#""string""#).is_err());
+        assert!(decode(r#""2016-07-08""#).is_err()); // :(
+        assert!(decode(r#"null"#).is_err());
     }
 }
 
 #[cfg(feature = "serde")]
 mod serde {
-    use std::fmt;
     use super::NaiveDate;
-    use serdelib::{ser, de};
+    use serde::{ser, de};
 
     // TODO not very optimized for space (binary formats would want something better)
 
     impl ser::Serialize for NaiveDate {
-        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
+        fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error>
             where S: ser::Serializer
         {
-            struct FormatWrapped<'a, D: 'a> {
-                inner: &'a D
-            }
-
-            impl<'a, D: fmt::Debug> fmt::Display for FormatWrapped<'a, D> {
-                fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-                    self.inner.fmt(f)
-                }
-            }
-
-            serializer.collect_str(&FormatWrapped { inner: &self })
+            serializer.serialize_str(&format!("{:?}", self))
         }
     }
 
     struct NaiveDateVisitor;
 
-    impl<'de> de::Visitor<'de> for NaiveDateVisitor {
+    impl de::Visitor for NaiveDateVisitor {
         type Value = NaiveDate;
 
-        fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result 
-        {
-            write!(formatter, "a formatted date string")
-        }
-
-        fn visit_str<E>(self, value: &str) -> Result<NaiveDate, E>
+        fn visit_str<E>(&mut self, value: &str) -> Result<NaiveDate, E>
             where E: de::Error
         {
             value.parse().map_err(|err| E::custom(format!("{}", err)))
         }
     }
 
-    impl<'de> de::Deserialize<'de> for NaiveDate {
-        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
-            where D: de::Deserializer<'de>
+    impl de::Deserialize for NaiveDate {
+        fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>
+            where D: de::Deserializer
         {
-            deserializer.deserialize_str(NaiveDateVisitor)
+            deserializer.deserialize(NaiveDateVisitor)
         }
     }
 
     #[cfg(test)] extern crate serde_json;
-    #[cfg(test)] extern crate bincode;
 
     #[test]
     fn test_serde_serialize() {
-        super::test_encodable_json(self::serde_json::to_string);
+        use self::serde_json::to_string;
+
+        assert_eq!(to_string(&NaiveDate::from_ymd(2014, 7, 24)).ok(),
+                   Some(r#""2014-07-24""#.into()));
+        assert_eq!(to_string(&NaiveDate::from_ymd(0, 1, 1)).ok(),
+                   Some(r#""0000-01-01""#.into()));
+        assert_eq!(to_string(&NaiveDate::from_ymd(-1, 12, 31)).ok(),
+                   Some(r#""-0001-12-31""#.into()));
+        assert_eq!(to_string(&super::MIN).ok(),
+                   Some(r#""-262144-01-01""#.into()));
+        assert_eq!(to_string(&super::MAX).ok(),
+                   Some(r#""+262143-12-31""#.into()));
     }
 
     #[test]
     fn test_serde_deserialize() {
-        super::test_decodable_json(|input| self::serde_json::from_str(&input));
-    }
+        use self::serde_json;
+        use std::{i32, i64};
+
+        let from_str = |s: &str| serde_json::from_str::<NaiveDate>(s);
+
+        assert_eq!(from_str(r#""2016-07-08""#).ok(), Some(NaiveDate::from_ymd(2016, 7, 8)));
+        assert_eq!(from_str(r#""2016-7-8""#).ok(), Some(NaiveDate::from_ymd(2016, 7, 8)));
+        assert_eq!(from_str(r#""+002016-07-08""#).ok(), Some(NaiveDate::from_ymd(2016, 7, 8)));
+        assert_eq!(from_str(r#""0000-01-01""#).ok(), Some(NaiveDate::from_ymd(0, 1, 1)));
+        assert_eq!(from_str(r#""0-1-1""#).ok(), Some(NaiveDate::from_ymd(0, 1, 1)));
+        assert_eq!(from_str(r#""-0001-12-31""#).ok(), Some(NaiveDate::from_ymd(-1, 12, 31)));
+        assert_eq!(from_str(r#""-262144-01-01""#).ok(), Some(super::MIN));
+        assert_eq!(from_str(r#""+262143-12-31""#).ok(), Some(super::MAX));
 
-    #[test]
-    fn test_serde_bincode() {
-        // Bincode is relevant to test separately from JSON because
-        // it is not self-describing.
-        use self::bincode::{Infinite, serialize, deserialize};
-
-        let d = NaiveDate::from_ymd(2014, 7, 24);
-        let encoded = serialize(&d, Infinite).unwrap();
-        let decoded: NaiveDate = deserialize(&encoded).unwrap();
-        assert_eq!(d, decoded);
+        // bad formats
+        assert!(from_str(r#""""#).is_err());
+        assert!(from_str(r#""20001231""#).is_err());
+        assert!(from_str(r#""2000-00-00""#).is_err());
+        assert!(from_str(r#""2000-02-30""#).is_err());
+        assert!(from_str(r#""2001-02-29""#).is_err());
+        assert!(from_str(r#""2002-002-28""#).is_err());
+        assert!(from_str(r#""yyyy-mm-dd""#).is_err());
+        assert!(from_str(r#"0"#).is_err());
+        assert!(from_str(r#"20.01"#).is_err());
+        assert!(from_str(&i32::MIN.to_string()).is_err());
+        assert!(from_str(&i32::MAX.to_string()).is_err());
+        assert!(from_str(&i64::MIN.to_string()).is_err());
+        assert!(from_str(&i64::MAX.to_string()).is_err());
+        assert!(from_str(r#"{}"#).is_err());
+        assert!(from_str(r#"{"ymdf":20}"#).is_err()); // :(
+        assert!(from_str(r#"null"#).is_err());
     }
 }
 
 #[cfg(test)]
 mod tests {
     use super::NaiveDate;
-    use super::{MIN_DATE, MIN_YEAR, MIN_DAYS_FROM_YEAR_0};
-    use super::{MAX_DATE, MAX_YEAR, MAX_DAYS_FROM_YEAR_0};
+    use super::{MIN, MIN_YEAR, MIN_DAYS_FROM_YEAR_0};
+    use super::{MAX, MAX_YEAR, MAX_DAYS_FROM_YEAR_0};
     use {Datelike, Weekday};
+    use duration::Duration;
     use std::{i32, u32};
-    use oldtime::Duration;
 
     #[test]
     fn test_date_from_ymd() {
         let ymd_opt = |y,m,d| NaiveDate::from_ymd_opt(y, m, d);
 
         assert!(ymd_opt(2012, 0, 1).is_none());
         assert!(ymd_opt(2012, 1, 1).is_some());
         assert!(ymd_opt(2012, 2, 29).is_some());
@@ -1755,41 +1684,42 @@ mod tests {
         assert_eq!(isoywd_opt(2018, 51, Weekday::Mon), Some(ymd(2018, 12, 17)));
         assert_eq!(isoywd_opt(2018, 51, Weekday::Sun), Some(ymd(2018, 12, 23)));
         assert_eq!(isoywd_opt(2018, 52, Weekday::Mon), Some(ymd(2018, 12, 24)));
         assert_eq!(isoywd_opt(2018, 52, Weekday::Sun), Some(ymd(2018, 12, 30)));
         assert_eq!(isoywd_opt(2018, 53, Weekday::Mon), None);
     }
 
     #[test]
-    fn test_date_from_isoywd_and_iso_week() {
+    fn test_date_from_isoymd_and_isoweekdate() {
         for year in 2000..2401 {
             for week in 1..54 {
                 for &weekday in [Weekday::Mon, Weekday::Tue, Weekday::Wed, Weekday::Thu,
                                  Weekday::Fri, Weekday::Sat, Weekday::Sun].iter() {
                     let d = NaiveDate::from_isoywd_opt(year, week, weekday);
                     if d.is_some() {
                         let d = d.unwrap();
                         assert_eq!(d.weekday(), weekday);
-                        let w = d.iso_week();
-                        assert_eq!(w.year(), year);
-                        assert_eq!(w.week(), week);
+                        let (year_, week_, weekday_) = d.isoweekdate();
+                        assert_eq!(year_, year);
+                        assert_eq!(week_, week);
+                        assert_eq!(weekday_, weekday);
                     }
                 }
             }
         }
 
         for year in 2000..2401 {
             for month in 1..13 {
                 for day in 1..32 {
                     let d = NaiveDate::from_ymd_opt(year, month, day);
                     if d.is_some() {
                         let d = d.unwrap();
-                        let w = d.iso_week();
-                        let d_ = NaiveDate::from_isoywd(w.year(), w.week(), d.weekday());
+                        let (year_, week_, weekday_) = d.isoweekdate();
+                        let d_ = NaiveDate::from_isoywd(year_, week_, weekday_);
                         assert_eq!(d, d_);
                     }
                 }
             }
         }
     }
 
     #[test]
@@ -1812,20 +1742,20 @@ mod tests {
         assert_eq!(from_ndays_from_ce(0), Some(NaiveDate::from_ymd(0, 12, 31))); // 1 BCE
         assert_eq!(from_ndays_from_ce(-365), Some(NaiveDate::from_ymd(0, 1, 1)));
         assert_eq!(from_ndays_from_ce(-366), Some(NaiveDate::from_ymd(-1, 12, 31))); // 2 BCE
 
         for days in (-9999..10001).map(|x| x * 100) {
             assert_eq!(from_ndays_from_ce(days).map(|d| d.num_days_from_ce()), Some(days));
         }
 
-        assert_eq!(from_ndays_from_ce(MIN_DATE.num_days_from_ce()), Some(MIN_DATE));
-        assert_eq!(from_ndays_from_ce(MIN_DATE.num_days_from_ce() - 1), None);
-        assert_eq!(from_ndays_from_ce(MAX_DATE.num_days_from_ce()), Some(MAX_DATE));
-        assert_eq!(from_ndays_from_ce(MAX_DATE.num_days_from_ce() + 1), None);
+        assert_eq!(from_ndays_from_ce(MIN.num_days_from_ce()), Some(MIN));
+        assert_eq!(from_ndays_from_ce(MIN.num_days_from_ce() - 1), None);
+        assert_eq!(from_ndays_from_ce(MAX.num_days_from_ce()), Some(MAX));
+        assert_eq!(from_ndays_from_ce(MAX.num_days_from_ce() + 1), None);
     }
 
     #[test]
     fn test_date_fields() {
         fn check(year: i32, month: u32, day: u32, ordinal: u32) {
             let d1 = NaiveDate::from_ymd(year, month, day);
             assert_eq!(d1.year(), year);
             assert_eq!(d1.month(), month);
@@ -1921,36 +1851,36 @@ mod tests {
 
     #[test]
     fn test_date_succ() {
         let ymd = |y,m,d| NaiveDate::from_ymd(y, m, d);
         assert_eq!(ymd(2014, 5, 6).succ_opt(), Some(ymd(2014, 5, 7)));
         assert_eq!(ymd(2014, 5, 31).succ_opt(), Some(ymd(2014, 6, 1)));
         assert_eq!(ymd(2014, 12, 31).succ_opt(), Some(ymd(2015, 1, 1)));
         assert_eq!(ymd(2016, 2, 28).succ_opt(), Some(ymd(2016, 2, 29)));
-        assert_eq!(ymd(MAX_DATE.year(), 12, 31).succ_opt(), None);
+        assert_eq!(ymd(MAX.year(), 12, 31).succ_opt(), None);
     }
 
     #[test]
     fn test_date_pred() {
         let ymd = |y,m,d| NaiveDate::from_ymd(y, m, d);
         assert_eq!(ymd(2016, 3, 1).pred_opt(), Some(ymd(2016, 2, 29)));
         assert_eq!(ymd(2015, 1, 1).pred_opt(), Some(ymd(2014, 12, 31)));
         assert_eq!(ymd(2014, 6, 1).pred_opt(), Some(ymd(2014, 5, 31)));
         assert_eq!(ymd(2014, 5, 7).pred_opt(), Some(ymd(2014, 5, 6)));
-        assert_eq!(ymd(MIN_DATE.year(), 1, 1).pred_opt(), None);
+        assert_eq!(ymd(MIN.year(), 1, 1).pred_opt(), None);
     }
 
     #[test]
     fn test_date_add() {
         fn check((y1,m1,d1): (i32, u32, u32), rhs: Duration, ymd: Option<(i32, u32, u32)>) {
             let lhs = NaiveDate::from_ymd(y1, m1, d1);
             let sum = ymd.map(|(y,m,d)| NaiveDate::from_ymd(y, m, d));
-            assert_eq!(lhs.checked_add_signed(rhs), sum);
-            assert_eq!(lhs.checked_sub_signed(-rhs), sum);
+            assert_eq!(lhs.checked_add(rhs), sum);
+            assert_eq!(lhs.checked_sub(-rhs), sum);
         }
 
         check((2014, 1, 1), Duration::zero(), Some((2014, 1, 1)));
         check((2014, 1, 1), Duration::seconds(86399), Some((2014, 1, 1)));
         // always round towards zero
         check((2014, 1, 1), Duration::seconds(-86399), Some((2014, 1, 1)));
         check((2014, 1, 1), Duration::days(1), Some((2014, 1, 2)));
         check((2014, 1, 1), Duration::days(-1), Some((2013, 12, 31)));
@@ -1969,52 +1899,32 @@ mod tests {
         check((0, 1, 1), Duration::min_value(), None);
     }
 
     #[test]
     fn test_date_sub() {
         fn check((y1,m1,d1): (i32, u32, u32), (y2,m2,d2): (i32, u32, u32), diff: Duration) {
             let lhs = NaiveDate::from_ymd(y1, m1, d1);
             let rhs = NaiveDate::from_ymd(y2, m2, d2);
-            assert_eq!(lhs.signed_duration_since(rhs), diff);
-            assert_eq!(rhs.signed_duration_since(lhs), -diff);
+            assert_eq!(lhs - rhs, diff);
+            assert_eq!(rhs - lhs, -diff);
         }
 
         check((2014, 1, 1), (2014, 1, 1), Duration::zero());
         check((2014, 1, 2), (2014, 1, 1), Duration::days(1));
         check((2014, 12, 31), (2014, 1, 1), Duration::days(364));
         check((2015, 1, 3), (2014, 1, 1), Duration::days(365 + 2));
         check((2018, 1, 1), (2014, 1, 1), Duration::days(365*4 + 1));
         check((2414, 1, 1), (2014, 1, 1), Duration::days(365*400 + 97));
 
         check((MAX_YEAR, 12, 31), (0, 1, 1), Duration::days(MAX_DAYS_FROM_YEAR_0 as i64));
         check((MIN_YEAR, 1, 1), (0, 1, 1), Duration::days(MIN_DAYS_FROM_YEAR_0 as i64));
     }
 
     #[test]
-    fn test_date_addassignment() {
-        let ymd = NaiveDate::from_ymd;
-        let mut date = ymd(2016, 10, 1);
-        date += Duration::days(10);
-        assert_eq!(date,  ymd(2016, 10, 11));
-        date += Duration::days(30);
-        assert_eq!(date, ymd(2016, 11, 10));
-    }
-
-    #[test]
-    fn test_date_subassignment() {
-        let ymd = NaiveDate::from_ymd;
-        let mut date = ymd(2016, 10, 11);
-        date -= Duration::days(10);
-        assert_eq!(date,  ymd(2016, 10, 1));
-        date -= Duration::days(2);
-        assert_eq!(date, ymd(2016, 9, 29));
-    }
-
-    #[test]
     fn test_date_fmt() {
         assert_eq!(format!("{:?}", NaiveDate::from_ymd(2012,  3, 4)),   "2012-03-04");
         assert_eq!(format!("{:?}", NaiveDate::from_ymd(0,     3, 4)),   "0000-03-04");
         assert_eq!(format!("{:?}", NaiveDate::from_ymd(-307,  3, 4)),  "-0307-03-04");
         assert_eq!(format!("{:?}", NaiveDate::from_ymd(12345, 3, 4)), "+12345-03-04");
 
         assert_eq!(NaiveDate::from_ymd(2012,  3, 4).to_string(),   "2012-03-04");
         assert_eq!(NaiveDate::from_ymd(0,     3, 4).to_string(),   "0000-03-04");
@@ -2114,8 +2024,783 @@ mod tests {
         // corner cases
         assert_eq!(NaiveDate::from_ymd(2007, 12, 31).format("%G,%g,%U,%W,%V").to_string(),
                    "2008,08,53,53,01");
         assert_eq!(NaiveDate::from_ymd(2010, 1, 3).format("%G,%g,%U,%W,%V").to_string(),
                    "2009,09,01,00,53");
     }
 }
 
+/// The internal implementation of the calendar and ordinal date.
+///
+/// The current implementation is optimized for determining year, month, day and day of week.
+/// 4-bit `YearFlags` map to one of 14 possible classes of year in the Gregorian calendar,
+/// which are included in every packed `NaiveDate` instance.
+/// The conversion between the packed calendar date (`Mdf`) and the ordinal date (`Of`) is
+/// based on the moderately-sized lookup table (~1.5KB)
+/// and the packed representation is chosen for the efficient lookup.
+/// Every internal data structure does not validate its input,
+/// but the conversion keeps the valid value valid and the invalid value invalid
+/// so that the user-facing `NaiveDate` can validate the input as late as possible.
+#[allow(dead_code)] // some internal methods have been left for consistency
+mod internals {
+    use std::{i32, fmt};
+    use num::traits::FromPrimitive;
+    use Weekday;
+    use div::{div_rem, mod_floor};
+
+    /// The internal date representation. This also includes the packed `Mdf` value.
+    pub type DateImpl = i32;
+
+    pub const MAX_YEAR: DateImpl = i32::MAX >> 13;
+    pub const MIN_YEAR: DateImpl = i32::MIN >> 13;
+
+    /// The year flags (aka the dominical letter).
+    ///
+    /// There are 14 possible classes of year in the Gregorian calendar:
+    /// common and leap years starting with Monday through Sunday.
+    /// The `YearFlags` stores this information into 4 bits `abbb`,
+    /// where `a` is `1` for the common year (simplifies the `Of` validation)
+    /// and `bbb` is a non-zero `Weekday` (mapping `Mon` to 7) of the last day in the past year
+    /// (simplifies the day of week calculation from the 1-based ordinal).
+    #[derive(PartialEq, Eq, Copy, Clone)]
+    pub struct YearFlags(pub u8);
+
+    pub const A: YearFlags = YearFlags(0o15); pub const AG: YearFlags = YearFlags(0o05);
+    pub const B: YearFlags = YearFlags(0o14); pub const BA: YearFlags = YearFlags(0o04);
+    pub const C: YearFlags = YearFlags(0o13); pub const CB: YearFlags = YearFlags(0o03);
+    pub const D: YearFlags = YearFlags(0o12); pub const DC: YearFlags = YearFlags(0o02);
+    pub const E: YearFlags = YearFlags(0o11); pub const ED: YearFlags = YearFlags(0o01);
+    pub const F: YearFlags = YearFlags(0o17); pub const FE: YearFlags = YearFlags(0o07);
+    pub const G: YearFlags = YearFlags(0o16); pub const GF: YearFlags = YearFlags(0o06);
+
+    static YEAR_TO_FLAGS: [YearFlags; 400] = [
+        BA, G, F, E, DC, B, A, G, FE, D, C, B, AG, F, E, D, CB, A, G, F,
+        ED, C, B, A, GF, E, D, C, BA, G, F, E, DC, B, A, G, FE, D, C, B,
+        AG, F, E, D, CB, A, G, F, ED, C, B, A, GF, E, D, C, BA, G, F, E,
+        DC, B, A, G, FE, D, C, B, AG, F, E, D, CB, A, G, F, ED, C, B, A,
+        GF, E, D, C, BA, G, F, E, DC, B, A, G, FE, D, C, B, AG, F, E, D, // 100
+        C,  B, A, G, FE, D, C, B, AG, F, E, D, CB, A, G, F, ED, C, B, A,
+        GF, E, D, C, BA, G, F, E, DC, B, A, G, FE, D, C, B, AG, F, E, D,
+        CB, A, G, F, ED, C, B, A, GF, E, D, C, BA, G, F, E, DC, B, A, G,
+        FE, D, C, B, AG, F, E, D, CB, A, G, F, ED, C, B, A, GF, E, D, C,
+        BA, G, F, E, DC, B, A, G, FE, D, C, B, AG, F, E, D, CB, A, G, F, // 200
+        E,  D, C, B, AG, F, E, D, CB, A, G, F, ED, C, B, A, GF, E, D, C,
+        BA, G, F, E, DC, B, A, G, FE, D, C, B, AG, F, E, D, CB, A, G, F,
+        ED, C, B, A, GF, E, D, C, BA, G, F, E, DC, B, A, G, FE, D, C, B,
+        AG, F, E, D, CB, A, G, F, ED, C, B, A, GF, E, D, C, BA, G, F, E,
+        DC, B, A, G, FE, D, C, B, AG, F, E, D, CB, A, G, F, ED, C, B, A, // 300
+        G,  F, E, D, CB, A, G, F, ED, C, B, A, GF, E, D, C, BA, G, F, E,
+        DC, B, A, G, FE, D, C, B, AG, F, E, D, CB, A, G, F, ED, C, B, A,
+        GF, E, D, C, BA, G, F, E, DC, B, A, G, FE, D, C, B, AG, F, E, D,
+        CB, A, G, F, ED, C, B, A, GF, E, D, C, BA, G, F, E, DC, B, A, G,
+        FE, D, C, B, AG, F, E, D, CB, A, G, F, ED, C, B, A, GF, E, D, C, // 400
+    ];
+
+    static YEAR_DELTAS: [u8; 401] = [
+         0,  1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,
+         5,  6,  6,  6,  6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9, 10, 10, 10,
+        10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15,
+        15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20,
+        20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, // 100
+        25, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29,
+        29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34,
+        34, 35, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39,
+        39, 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44,
+        44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, // 200
+        49, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53,
+        53, 54, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58,
+        58, 59, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63,
+        63, 64, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, 67, 68, 68, 68,
+        68, 69, 69, 69, 69, 70, 70, 70, 70, 71, 71, 71, 71, 72, 72, 72, 72, 73, 73, 73, // 300
+        73, 73, 73, 73, 73, 74, 74, 74, 74, 75, 75, 75, 75, 76, 76, 76, 76, 77, 77, 77,
+        77, 78, 78, 78, 78, 79, 79, 79, 79, 80, 80, 80, 80, 81, 81, 81, 81, 82, 82, 82,
+        82, 83, 83, 83, 83, 84, 84, 84, 84, 85, 85, 85, 85, 86, 86, 86, 86, 87, 87, 87,
+        87, 88, 88, 88, 88, 89, 89, 89, 89, 90, 90, 90, 90, 91, 91, 91, 91, 92, 92, 92,
+        92, 93, 93, 93, 93, 94, 94, 94, 94, 95, 95, 95, 95, 96, 96, 96, 96, 97, 97, 97, 97 // 400+1
+    ];
+
+    pub fn cycle_to_yo(cycle: u32) -> (u32, u32) {
+        let (mut year_mod_400, mut ordinal0) = div_rem(cycle, 365);
+        let delta = YEAR_DELTAS[year_mod_400 as usize] as u32;
+        if ordinal0 < delta {
+            year_mod_400 -= 1;
+            ordinal0 += 365 - YEAR_DELTAS[year_mod_400 as usize] as u32;
+        } else {
+            ordinal0 -= delta;
+        }
+        (year_mod_400, ordinal0 + 1)
+    }
+
+    pub fn yo_to_cycle(year_mod_400: u32, ordinal: u32) -> u32 {
+        year_mod_400 * 365 + YEAR_DELTAS[year_mod_400 as usize] as u32 + ordinal - 1
+    }
+
+    impl YearFlags {
+        #[inline]
+        pub fn from_year(year: i32) -> YearFlags {
+            let year = mod_floor(year, 400);
+            YearFlags::from_year_mod_400(year)
+        }
+
+        #[inline]
+        pub fn from_year_mod_400(year: i32) -> YearFlags {
+            YEAR_TO_FLAGS[year as usize]
+        }
+
+        #[inline]
+        pub fn ndays(&self) -> u32 {
+            let YearFlags(flags) = *self;
+            366 - (flags >> 3) as u32
+        }
+
+        #[inline]
+        pub fn isoweek_delta(&self) -> u32 {
+            let YearFlags(flags) = *self;