Skip to content

Restore Timestamp parity with Dates - #7

Merged
quinnj merged 3 commits into
mainfrom
fix/timestamp-stdlib-parity
Oct 2, 2026
Merged

quinnj merged 3 commits into
mainfrom
fix/timestamp-stdlib-parity

Conversation

@quinnj

@quinnj quinnj commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Custom fractional-resolution timestamps currently truncate arithmetic and calendar fields, and wide Int128 counts can overflow during conversion and rounding. This restores the compatibility implementation's parity with JuliaLang/julia#62994: exact fractional scales, widened intermediates, raw-instant resolution validation, equal-resolution promotion, raw Hour/Minute conversions, Rational Unix conversion, subnanosecond formatting, and local fractional-resolution clocks.

Physical period unit metadata must be an Integer or Rational number of nanoseconds. Floating-point metadata, including 1.0, previously rounded counts above 2^53; it now raises a clear ArgumentError consistently in construction, raw conversion, arithmetic, rounding, and physical range steps. Calendar range estimates keep their existing behavior.

The Timestamp tests mirror the stdlib cases, with compatibility gates retained for behavior owned by older Dates. The custom-period documentation now describes the same extension contract. The follow-up adds 496 checks covering floating metadata, exact integer/rational alternatives, counts above 2^53, and Int128 boundaries.

A separate commit fixes an existing nightly trim failure in zoned.jl:norules. Concrete binary string calls preserve the error message and remove the vararg dispatch that failed safe trimming on unchanged main. This commit is independent of Timestamp parity.

Validation on macOS arm64:

  • Full suite: Julia 1.10.12 (8,914 assertions), Julia 1.13.0 (8,922), and Julia 1.14.0-DEV.3316 using the updated native Dates alias (8,925).
  • Safe trim: stable shim, nightly shim, and native Dates alias compiled and executed successfully.
  • Arrow Rewrite Arrow.jl internals for 3.0 apache/arrow-julia#609 integration: all four timestamp units, timezone metadata, nullable columns, raw Int64 extrema, and IPC round-trips; 768 assertions passed for each of the two shim runtimes and the native alias.
  • The paired Julia change passed all 11 Dates groups through the official revise-Dates runner (8,083,538 assertions).

Co-authored by Codex

Port the current JuliaLang/julia#62994 resolution validation, equal-resolution
promotion, raw-period conversions, Unix conversion, and subnanosecond
formatting to the compatibility implementation. Keep fractional-scale
arithmetic and calendar fields exact, and widen Int128 intermediates in
conversions, rounding, and ranges. Construct local fractional-resolution
clocks from whole seconds and raw ticks.

Assisted-by: Codex (GPT-6.1 Sol)
The unchanged main branch fails safe trimming when its missing-rules error
uses a three-string concatenation. Use concrete binary string calls to keep
the same message while making the error path compilable on nightly Julia.
This baseline fix is independent of Timestamp compatibility parity.

Assisted-by: Codex (GPT-6.1 Sol)
Mirror JuliaLang/julia#62994's requirement for Integer or Rational
nanoseconds per physical period unit. Floating metadata, including 1.0,
previously rounded counts above 2^53 during Timestamp operations. Reject it
consistently in construction, raw conversion, arithmetic, rounding, and
physical range steps while preserving calendar range estimates.

Assisted-by: Codex (GPT-6.1 Sol)
@quinnj
quinnj merged commit abf09cc into main Oct 2, 2026
9 checks passed
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.

1 participant