Repository navigation
Commit fcbcfd8
Time: advance MRI 4.0.6 conformance (arithmetic, sub-nanosecond precision, timezones) (#563)
* WIP: partial time2 conformance work (agent interrupted by session limit)
Committed to protect against scratchpad purge; to be finished, verified and
squashed before the PR is opened.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Time: exact +/- arithmetic, timezone-object getlocal/localtime, exact Rational seconds
Route Time#+/#- through a VM-aware path so a Rational/Float shift is coerced
with MRI num_exact and applied to the nanosecond (fixing coercion errors and
negative-Float truncation); reject Time+Time. Handle a timezone object in
Time#getlocal/#localtime via #utc_to_local. Parse a Rational seconds field for
Time.utc/local exactly instead of through a lossy Float64.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* gofmt wave11 test file
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Time: honour runtime TZ for local zone, fix %Z and -00:00 zone
Resolve the local timezone dynamically from ENV['TZ'] (Go tzdata), so a spec's
with_timezone block gets DST-aware IANA zones (EST/EDT etc.) and an unloadable
name defaults to UTC. strftime %Z now emits nothing for an offset-only zone
(matching MRI, not the numeric offset). A '-00:00' offset string is RFC 3339
unknown-offset UTC, so #zone reports 'UTC'.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Time: preserve exact sub-nanosecond sub-second (frac field)
Carry a big.Rat 'frac' for the sub-second part below one nanosecond that Go's
instant cannot hold, so Time#+/#- and Time.at(Float/Rational) keep MRI's exact
sub-second in #subsec and #to_r (whole-nanosecond fields unchanged). A
non-finite Time.at Float now raises FloatDomainError.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Time: Time.new(String, precision:) keeps sub-nanosecond digits
precision: nil or a negative count now keeps every sub-second digit (past the
ninth into frac) instead of clamping to 9, matching MRI 4.0.6; the default still
keeps 9 and an explicit count truncates.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Time: mix in Comparable
Time.include?(Comparable) is now true (MRI mixes it in); Time's own #<=> drives
Comparable's #between?/#clamp. Added in the post-prelude phase so the module
exists.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* test: cover numFloat's Float/Rational/error branches via File.utime
Removing timeOp orphaned numFloat's non-Integer branches; File.utime is its
remaining caller and legitimately accepts Float/Rational second counts and
rejects non-numerics, so exercise all branches there.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 191d44a commit fcbcfd8
7 files changed
Lines changed: 513 additions & 81 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
| |||
413 | 414 | | |
414 | 415 | | |
415 | 416 | | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
416 | 425 | | |
417 | 426 | | |
418 | 427 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
50 | 56 | | |
51 | 57 | | |
52 | 58 | | |
| |||
0 commit comments