FA-296 / Time representation / Open access
Truncating a negative epoch fraction selects the next second · case 01
An instant just before the Unix epoch is assigned to second zero, or rounding moves a positive fraction into a later second.
ROOT CAUSE
Truncation or nearest rounding is used where the timestamp representation requires the lower containing second.
VERIFIED REPAIR
Use exact integer floor division on the signed millisecond timestamp.
Unsuccessful approach: Nearest rounding corrects some negative fractions but changes the containing second for values beyond a midpoint.
Case contract
Convert an integer count of milliseconds since the Unix epoch to the integer second s satisfying 1000*s <= milliseconds < 1000*(s+1). Do not round to the nearest second and do not pass through floating point.
Why this case matters
Pre-epoch timestamps and high-magnitude archival timestamps reveal a distinction hidden by common positive, whole-second fixtures.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(milliseconds):
return int(milliseconds / 1000)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('negative fractional second', solve(-1000 * N - 1), -N - 1)
check('negative fraction close to next boundary', solve(-1000 * N + 1), -N)
check('positive late fraction stays in containing second', solve(1000 * N + 999), N)
check('exact negative second', solve(-1000 * N), -N)
check('exact positive second', solve(1000 * N), N)
check('epoch itself', solve(0), 0)
check('large timestamp retains integer precision', solve((2 ** 60 + N) * 1000 + 999), 2 ** 60 + N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| negative fractional second | -1 | -2 | Failed |
| negative fraction close to next boundary | 0 | -1 | Failed |
| positive late fraction stays in containing second | 1 | 1 | Passed |
| exact negative second | -1 | -1 | Passed |
| exact positive second | 1 | 1 | Passed |
| epoch itself | 0 | 0 | Passed |
| large timestamp retains integer precision | 1152921504606846976 | 1152921504606846977 | Failed |
SHA-256 / abbf59ad6a730602409aee204482de869cd7cbe337af7fb1bcd6538dc7f4690f
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(milliseconds):
return round(milliseconds / 1000)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('negative fractional second', solve(-1000 * N - 1), -N - 1)
check('negative fraction close to next boundary', solve(-1000 * N + 1), -N)
check('positive late fraction stays in containing second', solve(1000 * N + 999), N)
check('exact negative second', solve(-1000 * N), -N)
check('exact positive second', solve(1000 * N), N)
check('epoch itself', solve(0), 0)
check('large timestamp retains integer precision', solve((2 ** 60 + N) * 1000 + 999), 2 ** 60 + N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| negative fractional second | -1 | -2 | Failed |
| negative fraction close to next boundary | -1 | -1 | Passed |
| positive late fraction stays in containing second | 2 | 1 | Failed |
| exact negative second | -1 | -1 | Passed |
| exact positive second | 1 | 1 | Passed |
| epoch itself | 0 | 0 | Passed |
| large timestamp retains integer precision | 1152921504606846976 | 1152921504606846977 | Failed |
SHA-256 / 8ea7d7cc5f527b99ee94c8291c2515b136bea470dff2f202448943480a63e3da
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(milliseconds):
return milliseconds // 1000
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('negative fractional second', solve(-1000 * N - 1), -N - 1)
check('negative fraction close to next boundary', solve(-1000 * N + 1), -N)
check('positive late fraction stays in containing second', solve(1000 * N + 999), N)
check('exact negative second', solve(-1000 * N), -N)
check('exact positive second', solve(1000 * N), N)
check('epoch itself', solve(0), 0)
check('large timestamp retains integer precision', solve((2 ** 60 + N) * 1000 + 999), 2 ** 60 + N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| negative fractional second | -2 | -2 | Passed |
| negative fraction close to next boundary | -1 | -1 | Passed |
| positive late fraction stays in containing second | 1 | 1 | Passed |
| exact negative second | -1 | -1 | Passed |
| exact positive second | 1 | 1 | Passed |
| epoch itself | 0 | 0 | Passed |
| large timestamp retains integer precision | 1152921504606846977 | 1152921504606846977 | Passed |
SHA-256 / 60a2509bdc07ca46ada685ef5d312e38aa3057cf1cb4d7e769450a131b9dd607
Verification & scope
This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:36:52.067800+00:00.
Case digest / 0923354fc1d46db0dc68a7900201efd139ac059a735b3a88ed05c5292284cf67