From 3bd8e9de096914c03307adedfdaaaee152f1462c Mon Sep 17 00:00:00 2001 From: Paul Dicker Date: Tue, 16 Apr 2024 08:09:24 +0200 Subject: [PATCH 01/10] Adjust fork note and move below description, restore links --- parse-zoneinfo/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/parse-zoneinfo/README.md b/parse-zoneinfo/README.md index 848b6ff..d0f9673 100644 --- a/parse-zoneinfo/README.md +++ b/parse-zoneinfo/README.md @@ -1,17 +1,19 @@ # parse-zoneinfo -Parse-zoneinfo is a fork of [`zoneinfo_parse`][zoneinfo_parse], with adjustments such that it no longer depends on the `Datetime` crate. It is used by [`chrono-tz`][chrono_tz]. - Rust library for reading the text files comprising the [zoneinfo database][w], which records time zone changes and offsets across the world from multiple sources. The zoneinfo database is distributed in one of two formats: a raw text format with one file per continent, and a compiled binary format with one file per time zone. This crate deals with the former; for the latter, see the [`zoneinfo_compiled` crate][zc] instead. The database itself is maintained by IANA. For more information, see [IANA’s page on the time zone database][iana]. You can also find the text files themselves in [the tz repository][tz]. +Parse-zoneinfo is a fork of [`zoneinfo_parse`] by Benjamin Sago (now unmaintained). It is used by [`chrono-tz`]. + [iana]: https://www.iana.org/time-zones [tz]: https://github.com/eggert/tz [w]: https://en.wikipedia.org/wiki/Tz_database [zc]: https://github.com/rust-datetime/zoneinfo-compiled +[`zoneinfo_parse`]: https://crates.io/crates/zoneinfo_parse +[`chrono-tz`]: https://crates.io/crates/chrono-tz ### [View the Rustdoc](https://docs.rs/parse-zoneinfo) From 87df7da3fcd93cbb46291d753e46b92160f9aacd Mon Sep 17 00:00:00 2001 From: Paul Dicker Date: Tue, 23 Apr 2024 12:31:34 +0200 Subject: [PATCH 02/10] Don't mention `zoneinfo_compiled` --- parse-zoneinfo/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/parse-zoneinfo/README.md b/parse-zoneinfo/README.md index d0f9673..0c41d17 100644 --- a/parse-zoneinfo/README.md +++ b/parse-zoneinfo/README.md @@ -2,7 +2,7 @@ Rust library for reading the text files comprising the [zoneinfo database][w], which records time zone changes and offsets across the world from multiple sources. -The zoneinfo database is distributed in one of two formats: a raw text format with one file per continent, and a compiled binary format with one file per time zone. This crate deals with the former; for the latter, see the [`zoneinfo_compiled` crate][zc] instead. +The zoneinfo database is distributed in one of two formats: a raw text format with one file per continent, and a compiled binary format with one file per time zone. This crate deals with the text format. The database itself is maintained by IANA. For more information, see [IANA’s page on the time zone database][iana]. You can also find the text files themselves in [the tz repository][tz]. @@ -11,7 +11,6 @@ Parse-zoneinfo is a fork of [`zoneinfo_parse`] by Benjamin Sago (now unmaintaine [iana]: https://www.iana.org/time-zones [tz]: https://github.com/eggert/tz [w]: https://en.wikipedia.org/wiki/Tz_database -[zc]: https://github.com/rust-datetime/zoneinfo-compiled [`zoneinfo_parse`]: https://crates.io/crates/zoneinfo_parse [`chrono-tz`]: https://crates.io/crates/chrono-tz From 7c4d37c94f3734341c0c13c00d9b11e58a7b70ee Mon Sep 17 00:00:00 2001 From: Paul Dicker Date: Tue, 23 Apr 2024 12:35:21 +0200 Subject: [PATCH 03/10] Remove 'themselves' --- parse-zoneinfo/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parse-zoneinfo/README.md b/parse-zoneinfo/README.md index 0c41d17..be4dc36 100644 --- a/parse-zoneinfo/README.md +++ b/parse-zoneinfo/README.md @@ -4,7 +4,7 @@ Rust library for reading the text files comprising the [zoneinfo database][w], w The zoneinfo database is distributed in one of two formats: a raw text format with one file per continent, and a compiled binary format with one file per time zone. This crate deals with the text format. -The database itself is maintained by IANA. For more information, see [IANA’s page on the time zone database][iana]. You can also find the text files themselves in [the tz repository][tz]. +The database itself is maintained by IANA. For more information, see [IANA’s page on the time zone database][iana]. You can also find the text files in [the tz repository][tz]. Parse-zoneinfo is a fork of [`zoneinfo_parse`] by Benjamin Sago (now unmaintained). It is used by [`chrono-tz`]. From 0e2b352b20d30be1c0d5d4b1d77f436036fd711f Mon Sep 17 00:00:00 2001 From: Paul Dicker Date: Tue, 23 Apr 2024 12:32:23 +0200 Subject: [PATCH 04/10] Simplify link markdown --- parse-zoneinfo/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parse-zoneinfo/README.md b/parse-zoneinfo/README.md index be4dc36..1afa89c 100644 --- a/parse-zoneinfo/README.md +++ b/parse-zoneinfo/README.md @@ -1,6 +1,6 @@ # parse-zoneinfo -Rust library for reading the text files comprising the [zoneinfo database][w], which records time zone changes and offsets across the world from multiple sources. +Rust library for reading the text files comprising the [zoneinfo database], which records time zone changes and offsets across the world from multiple sources. The zoneinfo database is distributed in one of two formats: a raw text format with one file per continent, and a compiled binary format with one file per time zone. This crate deals with the text format. @@ -10,7 +10,7 @@ Parse-zoneinfo is a fork of [`zoneinfo_parse`] by Benjamin Sago (now unmaintaine [iana]: https://www.iana.org/time-zones [tz]: https://github.com/eggert/tz -[w]: https://en.wikipedia.org/wiki/Tz_database +[zoneinfo database]: https://en.wikipedia.org/wiki/Tz_database [`zoneinfo_parse`]: https://crates.io/crates/zoneinfo_parse [`chrono-tz`]: https://crates.io/crates/chrono-tz From a9a1cc0e39c3f7e9434fd7c70afe98fd3ccf01fd Mon Sep 17 00:00:00 2001 From: Paul Dicker Date: Tue, 23 Apr 2024 12:32:41 +0200 Subject: [PATCH 05/10] Remove docs.rs link --- parse-zoneinfo/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/parse-zoneinfo/README.md b/parse-zoneinfo/README.md index 1afa89c..ef4482f 100644 --- a/parse-zoneinfo/README.md +++ b/parse-zoneinfo/README.md @@ -14,8 +14,6 @@ Parse-zoneinfo is a fork of [`zoneinfo_parse`] by Benjamin Sago (now unmaintaine [`zoneinfo_parse`]: https://crates.io/crates/zoneinfo_parse [`chrono-tz`]: https://crates.io/crates/chrono-tz -### [View the Rustdoc](https://docs.rs/parse-zoneinfo) - # Installation This crate works with [Cargo](https://crates.io). Add the following to your `Cargo.toml` dependencies section: From 14cc19250e91900d0029bf62b7842732d93ecf51 Mon Sep 17 00:00:00 2001 From: Paul Dicker Date: Tue, 23 Apr 2024 12:33:10 +0200 Subject: [PATCH 06/10] Update 'example program' section --- parse-zoneinfo/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/parse-zoneinfo/README.md b/parse-zoneinfo/README.md index ef4482f..314c935 100644 --- a/parse-zoneinfo/README.md +++ b/parse-zoneinfo/README.md @@ -70,8 +70,11 @@ Once the input lines have been parsed, they must be *interpreted* to form a tabl The easiest way to do this is with a `TableBuilder`. You can add various lines to the builder, and it will throw an error as soon as it detects that something’s wrong, such as a duplicate or a missing entry. When all the lines have been fed to the builder, you can use the `build` method to produce a `Table` containing fields for the rule, zone, and link lines. +## Example program +The `example` folder of this crate contains a basic parser example. -## Example program +`parse-zoneinfo` is used to produce the data for [`chrono-tz`]. For a full example of its use see [`chrono-tz-build`]. + +[`chrono-tz-build`]: https://github.com/chronotope/chrono-tz/tree/main/chrono-tz-build -This crate is used to produce the data for the [`zoneinfo-data` crate](https://github.com/rust-datetime/zoneinfo-data). For an example of its use, see the bundled [data crate builder](https://github.com/rust-datetime/zoneinfo-parse/tree/master/data-crate-builder). From 57981e48a9802de6da4826ec5f6a35e9145c2c23 Mon Sep 17 00:00:00 2001 From: Paul Dicker Date: Tue, 16 Apr 2024 12:54:29 +0200 Subject: [PATCH 07/10] Remove installation section, only keep MSRV note --- parse-zoneinfo/README.md | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/parse-zoneinfo/README.md b/parse-zoneinfo/README.md index 314c935..b5fd9f2 100644 --- a/parse-zoneinfo/README.md +++ b/parse-zoneinfo/README.md @@ -14,16 +14,9 @@ Parse-zoneinfo is a fork of [`zoneinfo_parse`] by Benjamin Sago (now unmaintaine [`zoneinfo_parse`]: https://crates.io/crates/zoneinfo_parse [`chrono-tz`]: https://crates.io/crates/chrono-tz -# Installation +## Rust version requirements -This crate works with [Cargo](https://crates.io). Add the following to your `Cargo.toml` dependencies section: - -```toml -[dependencies] -parse-zoneinfo = "0.5" -``` - -The earliest version of Rust that this crate is tested against is [Rust v1.31.0](https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html). +The Minimum Supported Rust Version (MSRV) is currently **Rust 1.57.0**. # Usage From ba26e3fc90eb3aa6587d6734405d953107be04e9 Mon Sep 17 00:00:00 2001 From: Paul Dicker Date: Tue, 16 Apr 2024 12:55:45 +0200 Subject: [PATCH 08/10] Use unaltered copies of tz data in parse-zoneinfo readme --- parse-zoneinfo/README.md | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/parse-zoneinfo/README.md b/parse-zoneinfo/README.md index b5fd9f2..f54b0f3 100644 --- a/parse-zoneinfo/README.md +++ b/parse-zoneinfo/README.md @@ -23,12 +23,13 @@ The Minimum Supported Rust Version (MSRV) is currently **Rust 1.57.0**. The zoneinfo files contains `Zone`, `Rule`, and `Link` information. Each type of line forms a variant in the `line::Line` enum. To get started, here are a few lines representing what time is like in the `Europe/Madrid` time zone: - - # Zone NAME GMTOFF RULES FORMAT [UNTIL] - Zone Europe/Madrid -0:14:44 - LMT 1901 Jan 1 0:00s - 0:00 Spain WE%sT 1946 Sep 30 - 1:00 Spain CE%sT 1979 - 1:00 EU CE%sT +``` +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Europe/Madrid -0:14:44 - LMT 1901 Jan 1 0:00u + 0:00 Spain WE%sT 1940 Mar 16 23:00 + 1:00 Spain CE%sT 1979 + 1:00 EU CE%sT +``` The first line is a comment. The second starts with `Zone`, so we know @@ -41,22 +42,25 @@ So parsing these five lines would return the five following results: - As does the fifth. Lines with rule definitions look like this: - - # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S - Rule Spain 1917 only - May 5 23:00s 1:00 S - Rule Spain 1917 1919 - Oct 6 23:00s 0 - - Rule Spain 1918 only - Apr 15 23:00s 1:00 S - Rule Spain 1919 only - Apr 5 23:00s 1:00 S +``` +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Spain 1918 only - Apr 15 23:00 1:00 S +Rule Spain 1918 1919 - Oct 6 24:00s 0 - +Rule Spain 1919 only - Apr 6 23:00 1:00 S +Rule Spain 1924 only - Apr 16 23:00 1:00 S +Rule Spain 1924 only - Oct 4 24:00s 0 - +``` All these lines follow the same pattern: A `line::Line::Rule` that contains a `Rule` struct, which has a field for each column of data. Finally, there are lines that link one zone to another’s name: - - Link Europe/Prague Europe/Bratislava +``` +# Link TARGET LINK-NAME #= TARGET1 +link Australia/Sydney Australia/ACT #= Australia/Canberra +``` The `Link` struct simply contains the names of both the existing and new time zones. - ## Interpretation Once the input lines have been parsed, they must be *interpreted* to form a table of time zone data. From 63249a9108e7d61a53ce2ae531c7c047b42f9c7f Mon Sep 17 00:00:00 2001 From: Paul Dicker Date: Tue, 16 Apr 2024 08:18:48 +0200 Subject: [PATCH 09/10] Fix dead links in chrono-tz readme and reflow --- README.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 02e2d42..a58b166 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,12 @@ # Chrono-TZ -`Chrono-TZ` is a library that provides implementors of the -[`TimeZone`][timezone] trait for [`rust-chrono`][chrono]. The -impls are generated by a build script using the [`IANA database`][iana] -and [`parse-zoneinfo`][parse_zoneinfo]. +`Chrono-TZ` is a library that provides implementors of the [`TimeZone`] trait for [chrono]. The +impls are generated by a build script using the [`IANA database`][iana] and [`parse-zoneinfo`]. -[chrono]: https://github.com/lifthrasiir/rust-chrono -[timezone]: https://lifthrasiir.github.io/rust-chrono/chrono/offset/trait.TimeZone.html +[chrono]: https://crates.io/crates/chrono +[`TimeZone`]: https://docs.rs/chrono/latest/chrono/trait.TimeZone.html [iana]: http://www.iana.org/time-zones -[parse_zoneinfo]: https://github.com/djzin/parse-zoneinfo +[`parse-zoneinfo`]: https://crates.io/crates/parse-zoneinfo ## Documentation From 8fe55773e78eb0e51e3cf8ad003abffe4821d08f Mon Sep 17 00:00:00 2001 From: Paul Dicker Date: Tue, 16 Apr 2024 08:19:02 +0200 Subject: [PATCH 10/10] Remove example of how to set `filter-by-regex` feature --- README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/README.md b/README.md index a58b166..08528d7 100644 --- a/README.md +++ b/README.md @@ -150,11 +150,6 @@ environment variable to select them. The environment variable is called `CHRONO_TZ_TIMEZONE_FILTER` and is a regular expression. It should be specified in your top-level build: -```toml -[dependencies] -chrono-tz = { version = "0.6", features = [ "filter-by-regex" ] } -``` - ```sh CHRONO_TZ_TIMEZONE_FILTER="(Europe/London|US/.*)" cargo build ```