Skip to content

Commit

Permalink
perf: short circuit in POSIX tz when there is no DST
Browse files Browse the repository at this point in the history
Ref #103

PR #104
  • Loading branch information
1996fanrui authored Aug 18, 2024
1 parent 5b11089 commit 76c103e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/tz/posix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,10 @@ impl ReasonablePosixTimeZone {
&self,
timestamp: Timestamp,
) -> (Offset, Dst, &str) {
if self.dst.is_none() {
return (self.std_offset(), Dst::No, &self.std_abbrev);
}

let dt = Offset::UTC.to_datetime(timestamp);
self.dst_info_utc(dt.date().year_ranged())
.filter(|dst_info| dst_info.in_dst(dt))
Expand Down

0 comments on commit 76c103e

Please sign in to comment.