Skip to content

Conversation

sertonix
Copy link

This PR extends TZdb to honor the TZ environment variable and fall back to UTC if /etc/localtime does not exist.

This is more consistent with C and allows overwriting local time as unprivileged user.

I would kindly ask for help with writing a test for the TZ environment variable since I am very new to lean. More specifically: How should I set an environment variable for a test?

@sertonix sertonix requested a review from TwoFX as a code owner September 22, 2025 19:51
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Sep 22, 2025
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Sep 22, 2025

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 20b0bd0a2018295db19d3dabb5905841fd16a679 --onto 9fc18b8ab462cb9100d37a23814ebbac330e8577. You can force Mathlib CI using the force-mathlib-ci label. (2025-09-22 20:42:03)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 20b0bd0a2018295db19d3dabb5905841fd16a679 --onto 0807f73171ca8f765c11ef37d69fd95e6613a878. You can force Mathlib CI using the force-mathlib-ci label. (2025-09-24 13:04:35)

@leanprover-bot
Copy link
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 20b0bd0a2018295db19d3dabb5905841fd16a679 --onto d3dda9f6d4428a906c096067ecb75e432afc4615. You can force reference manual CI using the force-manual-ci label. (2025-09-22 20:42:04)

@TwoFX TwoFX added the changelog-library Library label Sep 23, 2025
@TwoFX
Copy link
Member

TwoFX commented Sep 23, 2025

Thanks for the PR!

I would kindly ask for help with writing a test for the TZ environment variable since I am very new to lean. More specifically: How should I set an environment variable for a test?

You can add a new test directory to tests/pkg/. These tests are just small Lean projects together with a script test.sh that can invoke lake build, run the resulting executable with different environment variables, etc.

This PR extends TZdb to honor the `TZ` environment variable and fall
back to `UTC` if `/etc/localtime` does not exist.

This is more consistent with C and allows overwriting local time as
unprivileged user.
@sertonix
Copy link
Author

sertonix commented Sep 24, 2025

Thanks! I think the test works now

@leanprover-bot leanprover-bot added the P-medium We may work on this issue if we find the time label Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-library Library P-medium We may work on this issue if we find the time toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants