Skip to content

Commit

Permalink
Never strip GMT and UTC time zones
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Apr 5, 2024
1 parent c28fd9c commit c41259c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bin/test-regex-filtering.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -euxo pipefail

export RUST_BACKTRACE=1
export CHRONO_TZ_TIMEZONE_FILTER='(Europe/London|GMT|UTC)'
export CHRONO_TZ_TIMEZONE_FILTER='(Europe/London)'

cd chrono-tz/tests/check-regex-filtering

Expand Down
8 changes: 5 additions & 3 deletions chrono-tz-build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ mod filter {
}

/// Module containing code supporting filter-by-regex feature
///
/// The "GMT" and "UTC" time zones are always included.
#[cfg(feature = "filter-by-regex")]
mod filter {
use std::collections::HashSet;
Expand Down Expand Up @@ -390,13 +392,13 @@ mod filter {
fn filter_timezone_table(table: &mut Table, filter_regex: Regex) {
// Compute the transitive closure of things to keep.
// Doing this, instead of just filtering `zonesets` and `links` by the
// regiex, helps to keep the `structure()` intact.
// regex, helps to keep the `structure()` intact.
let mut keep = HashSet::new();
for (k, v) in &table.links {
if filter_regex.is_match(k) {
if filter_regex.is_match(k) || k == "GMT" || k == "UTC" {
insert_keep_entry(&mut keep, k);
}
if filter_regex.is_match(v) {
if filter_regex.is_match(v) || k == "GMT" || k == "UTC" {
insert_keep_entry(&mut keep, v);
}
}
Expand Down

0 comments on commit c41259c

Please sign in to comment.