Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for changing TZ vairable and cache it for Local timezone #853

Merged
merged 4 commits into from Nov 11, 2022

Conversation

esheppa
Copy link
Collaborator

@esheppa esheppa commented Oct 22, 2022

This should solve #834.

As discussed, I've done some basic benchmarks, and it seems that this has minimal effect on the standard /etc/localtime case, while being around 3% more expensive in the TZ variable case. However this seems justified as this now allows for the TZ variable to change.

empty TZ variable, timezone is a symlink at /etc/localtime

Before (e0b16e9…):

bench_get_local_time    time:   [79.480 ns 79.692 ns 79.923 ns]

After (360478c…):

bench_get_local_time    time:   [79.232 ns 79.383 ns 79.556 ns]

with TZ variable

Before (e0b16e9…):

bench_get_local_time    time:   [77.322 ns 77.664 ns 78.002 ns]

After (360478c…):

bench_get_local_time    time:   [79.711 ns 79.921 ns 80.155 ns]

@djc djc mentioned this pull request Oct 24, 2022
Copy link
Contributor

@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea to add a benchmark! I think these are good changes, asking for a bit more structure in the commit history so it becomes easier to infer the rationale for the constituent parts.

src/offset/local/tz_info/timezone.rs Outdated Show resolved Hide resolved
src/offset/local/tz_info/timezone.rs Outdated Show resolved Hide resolved
src/offset/local/unix.rs Outdated Show resolved Hide resolved
src/offset/local/unix.rs Outdated Show resolved Hide resolved
src/offset/local/unix.rs Show resolved Hide resolved
@esheppa esheppa force-pushed the local-tz-cache-env-var branch 3 times, most recently from 588efcb to 5462d49 Compare October 30, 2022 11:58
src/offset/local/unix.rs Outdated Show resolved Hide resolved
@djc djc mentioned this pull request Nov 9, 2022
@djc djc merged commit dc4287a into 0.4.x Nov 11, 2022
@djc djc deleted the local-tz-cache-env-var branch November 11, 2022 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants