Skip to content

fix: also pass TZ env var in docker wrapper for Go timezone#297

Merged
umputun merged 1 commit intomasterfrom
fix-tz-env-docker
Apr 21, 2026
Merged

fix: also pass TZ env var in docker wrapper for Go timezone#297
umputun merged 1 commit intomasterfrom
fix-tz-env-docker

Conversation

@umputun
Copy link
Copy Markdown
Owner

@umputun umputun commented Apr 21, 2026

Follow-up to #153. That fix detected the host timezone and forwarded it to the container as TIME_ZONE, but Go's time.Now() reads the standard TZ env var, not TIME_ZONE, so progress-log timestamps still rendered UTC inside the container.

build_base_env_vars() now sets both: TIME_ZONE (consumed by baseimage to configure /etc/localtime) and TZ (consumed by Go's time.Local). Both come from the same detect_timezone() result so they can't drift.

Closes #295

Go's time.Now() reads the standard TZ env var (not TIME_ZONE), so
container timestamps defaulted to UTC even when the host timezone was
detected. Pass both TIME_ZONE (for baseimage /etc/localtime) and TZ
(for Go's time.Local to keep the two in sync.

Follow-up to #153.

Closes #295
EOF
)
Copilot AI review requested due to automatic review settings April 21, 2026 21:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Docker wrapper so containerized runs use the host timezone consistently for both the base image’s OS timezone configuration and Go’s runtime timezone handling (fixing progress-log timestamps rendering as UTC in-container).

Changes:

  • Set both TIME_ZONE and TZ in build_base_env_vars() from a single detect_timezone() result.
  • Update the wrapper’s unit test to assert both env vars are present and match.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
scripts/ralphex-dk.sh Forward detected host timezone as both TIME_ZONE (baseimage) and TZ (Go) to keep timestamps consistent.
scripts/ralphex-dk/ralphex_dk_test.py Extend tests to validate both TIME_ZONE and TZ are included and correctly set.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@umputun umputun merged commit bd5e8db into master Apr 21, 2026
8 of 9 checks passed
@umputun umputun deleted the fix-tz-env-docker branch April 21, 2026 21:49
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.

TZ env var ignored in container: ralphex-dk.sh passes TIME_ZONE but Go reads TZ

2 participants