Skip to content

fix(windows): the status clock prints local time, as Go does - #30

Merged
t3dotgg merged 4 commits into
pingdotgg:mainfrom
jay911911:windows-local-time
Oct 9, 2026
Merged

t3dotgg merged 4 commits into
pingdotgg:mainfrom
jay911911:windows-local-time

Conversation

@jay911911

@jay911911 jay911911 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On Windows the status clock is UTC. tsc -b --verbose, --watch and the logger print it; the pinned Go build prints local time.

oracle (typescript@7.1.0-dev.20260929.1):  05:49:50 AM - Projects in this build:
tsc-rs:                                    09:49:49 PM - Projects in this build:

init_local in execute/tsc/diagnostics.rs ports only time/zoneinfo_unix.go ($TZ, /etc/localtime, the zoneinfo directories). None of those exist on Windows, so it falls back to UTC. Go on Windows uses time/zoneinfo_windows.go, which asks the system.

Change

On Windows init_local is jiff::tz::TimeZone::try_system(), with UTC as the fallback, as in Go. The Unix body is unchanged and now cfg(not(windows)).

This needs two jiff features for cfg(windows) only: tz-system and tzdb-bundle-platform (Windows has no zoneinfo files, so the zone data comes with the binary). Cargo.lock gains jiff-tzdb and jiff-tzdb-platform. Linux and macOS resolve the same features as before.

This needs your decision

It adds crates, which your rules do not allow without one. The alternatives I see:

  • about 40 lines of unsafe FFI to GetTimeZoneInformation, a 1:1 port of zoneinfo_windows.go (the workspace forbids unsafe)
  • leave the clock as UTC on Windows and record it as a known difference

I chose the jiff features because it is the only option with no unsafe. If you prefer another, please say so or close this.

One difference from Go remains: jiff reads TZ first on Windows, Go on Windows does not read it. It is recorded in a DIVERGES comment.

Verification (Windows 11, rustc 1.99.0, --release)

  • project::logging::logger::tests::log_time_is_local_time fails before and passes after.
  • tsc -b --verbose on a two-project build: the hour and AM/PM equal the pinned npm build's.
  • lib tests pass with this change together with test(windows): build and pass the test suites on x86_64-pc-windows-msvc #29; without this change that one test fails.
  • Linux and macOS were not run locally; the change is cfg(windows) only.

This work was done by an AI agent (Claude Code) on my Windows machine; the results above are from its runs there.

🤖 Generated with Claude Code

Note

Fix status clock to print local time on Windows

On Windows, init_local in diagnostics.rs now resolves the system timezone through jiff and falls back to UTC when the lookup fails. This matches Go's local-time behavior for the status clock.

  • Adds a Windows-only pinned jiff dependency with system-timezone and bundled timezone data features in Cargo.toml
  • Keeps the existing TZ environment-variable and zone-file resolution for non-Windows targets
  • Behavioral Change: Windows local-time initialization now returns UTC instead of the prior behavior when timezone resolution fails

Macroscope summarized 03cc33a.

Summary by CodeRabbit

  • Bug Fixes
    • Improved local timezone handling for diagnostic output on Windows. The system timezone is used when available, with UTC as a fallback.
    • Windows timezone behavior may differ from Go’s, particularly in how local timezone settings are interpreted.

init_local ported only time/zoneinfo_unix.go, so on Windows the clock of
tsc -b --verbose and of the logger was UTC. On Windows it now takes the
system zone through jiff (tz-system, zone data bundled for Windows only).
Adds jiff-tzdb and jiff-tzdb-platform for cfg(windows).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 66898103-ee8b-4518-8161-b24cfcca8069

📥 Commits

Reviewing files that changed from the base of the PR and between 4f7a918 and 03cc33a.


⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5a035290-d3bc-449c-afc4-ba417d94143d

📥 Commits

Reviewing files that changed from the base of the PR and between 1b33589 and 4f7a918.


📒 Files selected for processing (1)
  • crates/ts_goport/src/execute/tsc/diagnostics.rs

🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/ts_goport/src/execute/tsc/diagnostics.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.



Walkthrough

Windows builds now use a separate init_local implementation that reads the system timezone through jiff and falls back to UTC if lookup fails. Non-Windows builds retain the existing implementation.

Changes

Windows timezone initialization

Layer / File(s) Summary
Platform-specific local timezone initialization
crates/ts_goport/Cargo.toml, crates/ts_goport/src/execute/tsc/diagnostics.rs
The Windows-targeted jiff dependency enables system timezone support. Windows builds use TimeZone::try_system() and fall back to UTC. The existing initializer is gated to non-Windows targets. Comments describe the platform handling and differences from Go.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: t3dotgg

Merge Risk: ⚪ Minimal · up to 4f7a9

The status clock uses the detected Windows timezone when available, with the intended UTC fallback. No identified issue prevents merging after normal checks.

Architecture Summary

Architecture risk: 🔵 Low · up to fb5bd

The change affects 1 system.

Changed systems: crates

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — crates (service) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in crates/ts_goport/Cargo.toml: Added a Windows-targeted jiff dependency with std, tz-system, and tzdb-bundle-platform features; previously, no Windows-specific jiff dependency was declared.
  • observed — Modified behavior in crates/ts_goport/src/execute/tsc/diagnostics.rs: The existing init_local implementation is now compiled only on non-Windows targets; Windows targets use a separate implementation.
  • observed — Modified behavior in crates/ts_goport/src/execute/tsc/diagnostics.rs: Adds Windows init_local, which obtains the system timezone through jiff::tz::TimeZone::try_system() and falls back to UTC on failure. The accompanying comments document its relationship to Go’s Windows timezone handling and the TZ behavior difference.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: fixing the Windows status clock to display local time, consistent with Go behavior.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.


✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@t3dotgg t3dotgg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Note

🤖 Claude Opus 5.5 responding on behalf of Theo

Thanks. This is a real difference from tsc on Windows, so it is worth fixing.

My recommendation to Theo is to take this version:

  • jiff is already a dependency. The new features and the 2 crates (jiff-tzdb, jiff-tzdb-platform) are cfg(windows) only. Linux and macOS resolve the same set as before.
  • The other options are worse. The FFI port needs unsafe, which the workspace forbids. Keeping UTC leaves a known difference in tsc -b --verbose, --watch and the logs.
  • The one divergence (jiff reads TZ first on Windows) is small and marked with DIVERGES.

New crates need Theo's decision, so he will merge or close this. I approved the CI run (Linux and macOS only, so it checks that nothing changes there).

t3dotgg added a commit that referenced this pull request Oct 9, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
t3dotgg and others added 3 commits October 9, 2026 02:13
The Go line is zoneinfo_windows.go:230 at go1.27.1. The comment now also
names the unmapped-zone and daylight-setting differences, and that the
logger test relies on jiff reading TZ on Windows. The section header no
longer says the port is Unix only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@t3dotgg

t3dotgg commented Oct 9, 2026

Copy link
Copy Markdown
Member

Note

🤖 Claude Opus 5.5 responding on behalf of Theo

Thanks @jay911911. This is good. I will merge it.

What I checked:

  • Go on Windows (time/zoneinfo_windows.go:230) does not read TZ, but jiff does. This changes only the status clock, and only when TZ names a zone that is not the Windows zone. jiff has no API that skips TZ, so a fix needs unsafe. The DIVERGES note stays.
  • Linux, macOS and wasm resolve the same crates and features as before (cargo tree -e features). The 2 new crates are Windows only, with license Unlicense OR MIT.
  • cargo check --target x86_64-pc-windows-msvc passes. A x86_64-pc-windows-gnu build under Wine prints local time, the same as the Go build.
  • goport tests against R184: 181,868 kept, 0 lost. The output on the 4 gate projects is identical.

I added one commit (4f7a918). It fixes the Go line number and names the other small differences in the comment.

@t3dotgg
t3dotgg merged commit c24bca7 into pingdotgg:main Oct 9, 2026
5 checks passed
JakubCzarlinski pushed a commit to JakubCzarlinski/ts-rust that referenced this pull request Oct 9, 2026
…er, --singleThreaded tsc -b and watch carry ids, value_symbol_links newtype)

followups38 is main 8ac70c6 plus 7 commits, so this merge also brings
main's PR code (pingdotgg#8, pingdotgg#10, pingdotgg#19, pingdotgg#30) and the light flake fix bf57472.

Conflict: crates/ts_goport/tests/early_emit.rs.
- ours (int56, eeflake1): the full K2 test change; build_emit_only_solution
  uses Solution and waits with Solution::wait_for_a_later_mtime.
- theirs (main bf57472): only the mtime wait (free fn
  wait_for_a_later_mtime) in the old build_emit_only_solution.
Took ours, as state note main-flake-fix-2026-10-09 says (int56 carries
the full eeflake1 change, which includes the mtime wait).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.

2 participants