time: use C altzone when available#8357
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe host environment now detects CPython-compatible ChangesHost altzone support
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Cargo
participant BuildScript as host_env build.rs
participant CCompiler as C compiler
participant HostTime as host_env time::tz
participant PythonTime as Python time module
Cargo->>BuildScript: Run build script
BuildScript->>CCompiler: Compile altzone probe
CCompiler-->>BuildScript: Return compilation status
BuildScript-->>Cargo: Emit has_altzone cfg when supported
PythonTime->>HostTime: Request altzone()
alt has_altzone
HostTime-->>PythonTime: Return native altzone
else fallback
HostTime-->>PythonTime: Return timezone() - 3600
end
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/host_env/build.rs`:
- Around line 21-25: Update the cross-compilation guard in build.rs to detect
target-specific compiler variables supported by cc::Build—CC_<target>,
CC_<target_with_underscores>, and TARGET_CC—before returning. Only skip the
altzone probe when host and target differ and none of these compiler settings
are present; preserve the existing cc::Build compiler resolution afterward.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro Plus
Run ID: 8279beb4-35d7-49b8-bba8-4514bbf2f0a4
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (4)
crates/host_env/Cargo.tomlcrates/host_env/build.rscrates/host_env/src/time.rscrates/vm/src/stdlib/time.rs
Summary
Fixed an issue where the existing
altzonewas simply calculated astimezone - 3600without checking for the presence ofaltzoneinlibc.During the build process, the code now checks for the existence of
altzoneand implements logic consistent with CPython.Summary by CodeRabbit
time.altzoneaccuracy by using the host-provided native daylight-saving offset when available.