FAILURE MAP
← Case archive

FA-6571 / Calendar arithmetic / Open access

Clock duration wrap one day · case 01

Overnight duration becomes negative without modular wrap.

Verified by executionVariant 1 · 4 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Overnight duration becomes negative without modular wrap.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return (end_seconds-start_seconds)%86400

Unsuccessful approach: Absolute difference chooses the reverse-day duration.

Case contract

Valid ISO Gregorian dates in years 1 through 9999; generated dates must remain in that range. Month is 1 through 12 and zero-based weekday is Monday 0 through Sunday 6 unless the output convention says otherwise. Both inputs are 0..86399; return the forward duration in [0,86400), treating equal readings as zero. Exact operational definition: (end_seconds-start_seconds)%86400

Why this case matters

Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Calendar conventions results depend on the stated convention.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(start_seconds, end_seconds):
    return end_seconds-start_seconds
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (86300, 100)', solve(*(86300, 100)), 200)
check('fixture 2: (100, 300)', solve(*(100, 300)), 200)
check('fixture 3: (0, 0)', solve(*(0, 0)), 0)
check('fixture 4: (3600, 0)', solve(*(3600, 0)), 82800)
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 fixtureActualExpectedOutcome
fixture 1: (86300, 100)-86200200Failed
fixture 2: (100, 300)200200Passed
fixture 3: (0, 0)00Passed
fixture 4: (3600, 0)-360082800Failed

SHA-256 / a76387b79dc71bde5e8421bebc7d8958f9f4c4668e04ec2530a051e0caf1b8b8

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(start_seconds, end_seconds):
    return abs(end_seconds-start_seconds)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (86300, 100)', solve(*(86300, 100)), 200)
check('fixture 2: (100, 300)', solve(*(100, 300)), 200)
check('fixture 3: (0, 0)', solve(*(0, 0)), 0)
check('fixture 4: (3600, 0)', solve(*(3600, 0)), 82800)
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 fixtureActualExpectedOutcome
fixture 1: (86300, 100)86200200Failed
fixture 2: (100, 300)200200Passed
fixture 3: (0, 0)00Passed
fixture 4: (3600, 0)360082800Failed

SHA-256 / bad481ed1d6aaeb8c964a92c8a5c4d28f5b19e2c8e7a9cdf1ed37ccedf6d58be

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(start_seconds, end_seconds):
    return (end_seconds-start_seconds)%86400
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (86300, 100)', solve(*(86300, 100)), 200)
check('fixture 2: (100, 300)', solve(*(100, 300)), 200)
check('fixture 3: (0, 0)', solve(*(0, 0)), 0)
check('fixture 4: (3600, 0)', solve(*(3600, 0)), 82800)
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 fixtureActualExpectedOutcome
fixture 1: (86300, 100)200200Passed
fixture 2: (100, 300)200200Passed
fixture 3: (0, 0)00Passed
fixture 4: (3600, 0)8280082800Passed

SHA-256 / 50ae727eecf9b69d7ac7b32e05da44693c4c17e4b7a42a0179375b49815eee94

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:38:03.217199+00:00.

Case digest / 3430fa3827860ca1fbc54dc2719028a76256163d99d1cbf0b562e10e66b68bea