FA-78791 / Broadcast timecode arithmetic / Open access
Chase-lock offset with subframes: half-day tie · case 01
Small negative offsets are reported as almost a full day.
ROOT CAUSE
The shorter-way fold never triggers.
VERIFIED REPAIR
Fold offsets above half a day to negative.
Unsuccessful approach: Folding exactly half a day contradicts the positive tie rule.
Case contract
Labels HH:MM:SS:FF.s where s is one or two digits of hundredths of a frame (".5" means 50). Return the offset from a to b as [frames, subframes] along the shorter way round 24 hours (exactly 12 hours is positive), with both components carrying the sign and 0 <= |subframes| < 100.
Why this case matters
Timecode arithmetic errors misplace edits, commercial breaks and captions against the broadcast clock.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(a, b, fps):
def parse(t):
main,sub=t.split('.')
h,m,s,f=map(int,main.split(':'))
return (((h*60+m)*60+s)*fps+f)*100+int(sub.ljust(2,'0'))
day=86400*fps*100
d=(parse(b)-parse(a))%day
if d>day:
d-=day
sign=-1 if d<0 else 1
q,r=divmod(abs(d),100)
return [sign*q,sign*r]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: half-day tie', ['00:00:00:01.50', '00:00:00:00.00', 25], [-1, -50]), ('regression variant: half-day tie', ['01:30:00:00.5', '01:00:59:00.05', 30], [-52230, -45]), ('partial repair probe: half-day tie', ['01:30:59:29.05', '13:30:59:29.05', 30], [1296000, 0]), ('partial repair variant: half-day tie', ['00:59:30:00.99', '12:59:30:00.99', 25], [1080000, 0]), ('boundary control', ['00:00:00:00.00', '00:00:00:01.50', 25], [1, 50]), ('boundary control', ['23:59:59:24.5', '00:00:00:00.0', 25], [0, 50]), ('normal control', ['00:59:59:00.5', '01:59:00:29.50', 30], [106259, 0]), ('normal control', ['12:30:30:01.00', '23:30:00:24.05', 25], [989273, 5]), ('normal control', ['23:00:00:00.99', '00:00:59:01.99', 30], [109771, 0])], [('regression: half-day tie', ['01:00:59:29.50', '00:30:30:29.99', 30], [-54869, -51]), ('regression variant: half-day tie', ['00:00:00:01.05', '23:00:00:01.05', 25], [-90000, 0]), ('partial repair probe: half-day tie', ['23:30:00:29.50', '11:30:00:29.50', 30], [1296000, 0]), ('partial repair variant: half-day tie', ['12:59:59:01.50', '00:59:59:01.50', 25], [1080000, 0]), ('boundary control', ['23:59:59:24.5', '00:00:00:00.0', 25], [0, 50]), ('boundary control', ['00:00:00:00.00', '00:00:00:01.50', 25], [1, 50]), ('normal control', ['23:59:00:24.5', '00:30:59:01.0', 25], [47951, 50]), ('normal control', ['23:30:00:00.0', '00:59:30:00.99', 30], [161100, 99]), ('normal control', ['23:59:59:29.05', '00:59:00:01.00', 30], [106201, 95])], [('regression: half-day tie', ['01:00:30:00.99', '23:30:00:29.50', 30], [-162871, -49]), ('regression variant: half-day tie', ['00:59:00:29.00', '00:00:00:01.05', 30], [-106227, -95]), ('partial repair probe: half-day tie', ['00:00:00:29.05', '12:00:00:29.05', 30], [1296000, 0]), ('partial repair variant: half-day tie', ['12:30:59:01.99', '00:30:59:01.99', 30], [1296000, 0]), ('boundary control', ['00:00:00:00.00', '00:00:00:01.50', 25], [1, 50]), ('boundary control', ['23:59:59:24.5', '00:00:00:00.0', 25], [0, 50]), ('normal control', ['23:00:00:00.05', '23:30:00:01.0', 30], [54000, 95]), ('normal control', ['00:30:00:01.0', '01:00:00:01.0', 30], [54000, 0]), ('normal control', ['00:59:00:01.50', '12:30:59:00.00', 25], [1037973, 50])], [('regression: half-day tie', ['01:59:30:29.50', '01:30:30:29.0', 30], [-52200, -50]), ('regression variant: half-day tie', ['00:59:30:01.5', '23:00:00:29.50', 30], [-215072, 0]), ('partial repair probe: half-day tie', ['00:59:59:01.05', '12:59:59:01.05', 30], [1296000, 0]), ('partial repair variant: half-day tie', ['00:59:00:24.00', '12:59:00:24.00', 25], [1080000, 0]), ('boundary control', ['23:59:59:24.5', '00:00:00:00.0', 25], [0, 50]), ('boundary control', ['00:00:00:00.00', '00:00:00:01.50', 25], [1, 50]), ('normal control', ['23:00:00:00.00', '01:00:30:01.0', 25], [180751, 0]), ('normal control', ['23:30:30:01.99', '23:59:59:01.05', 25], [44224, 6]), ('normal control', ['23:00:59:29.00', '00:30:00:00.50', 30], [160201, 50])], [('regression: half-day tie', ['12:59:30:01.50', '00:59:59:00.05', 30], [-1295131, -45]), ('regression variant: half-day tie', ['12:00:59:01.50', '01:00:00:01.05', 25], [-991475, -45]), ('partial repair probe: half-day tie', ['00:59:30:01.0', '12:59:30:01.0', 30], [1296000, 0]), ('partial repair variant: half-day tie', ['01:00:00:24.50', '13:00:00:24.50', 25], [1080000, 0]), ('boundary control', ['00:00:00:00.00', '00:00:00:01.50', 25], [1, 50]), ('boundary control', ['23:59:59:24.5', '00:00:00:00.0', 25], [0, 50]), ('normal control', ['00:59:00:24.0', '01:00:00:00.00', 25], [1476, 0]), ('normal control', ['01:00:00:01.5', '12:30:30:00.50', 30], [1242899, 0]), ('normal control', ['23:30:59:01.05', '01:30:30:00.99', 30], [215129, 94])]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
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 |
|---|---|---|---|
| regression: half-day tie | [2159998, 50] | [-1, -50] | Failed |
| regression variant: half-day tie | [2539769, 55] | [-52230, -45] | Failed |
| partial repair probe: half-day tie | [1296000, 0] | [1296000, 0] | Passed |
| partial repair variant: half-day tie | [1080000, 0] | [1080000, 0] | Passed |
| boundary control | [1, 50] | [1, 50] | Passed |
| boundary control | [0, 50] | [0, 50] | Passed |
| normal control | [106259, 0] | [106259, 0] | Passed |
| normal control | [989273, 5] | [989273, 5] | Passed |
| normal control | [109771, 0] | [109771, 0] | Passed |
SHA-256 / b274c1db88646787d93d7a2e059a831a3336dfafe74dd3b2b2a8fcee2465dde3
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(a, b, fps):
def parse(t):
main,sub=t.split('.')
h,m,s,f=map(int,main.split(':'))
return (((h*60+m)*60+s)*fps+f)*100+int(sub.ljust(2,'0'))
day=86400*fps*100
d=(parse(b)-parse(a))%day
if d>=day//2:
d-=day
sign=-1 if d<0 else 1
q,r=divmod(abs(d),100)
return [sign*q,sign*r]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: half-day tie', ['00:00:00:01.50', '00:00:00:00.00', 25], [-1, -50]), ('regression variant: half-day tie', ['01:30:00:00.5', '01:00:59:00.05', 30], [-52230, -45]), ('partial repair probe: half-day tie', ['01:30:59:29.05', '13:30:59:29.05', 30], [1296000, 0]), ('partial repair variant: half-day tie', ['00:59:30:00.99', '12:59:30:00.99', 25], [1080000, 0]), ('boundary control', ['00:00:00:00.00', '00:00:00:01.50', 25], [1, 50]), ('boundary control', ['23:59:59:24.5', '00:00:00:00.0', 25], [0, 50]), ('normal control', ['00:59:59:00.5', '01:59:00:29.50', 30], [106259, 0]), ('normal control', ['12:30:30:01.00', '23:30:00:24.05', 25], [989273, 5]), ('normal control', ['23:00:00:00.99', '00:00:59:01.99', 30], [109771, 0])], [('regression: half-day tie', ['01:00:59:29.50', '00:30:30:29.99', 30], [-54869, -51]), ('regression variant: half-day tie', ['00:00:00:01.05', '23:00:00:01.05', 25], [-90000, 0]), ('partial repair probe: half-day tie', ['23:30:00:29.50', '11:30:00:29.50', 30], [1296000, 0]), ('partial repair variant: half-day tie', ['12:59:59:01.50', '00:59:59:01.50', 25], [1080000, 0]), ('boundary control', ['23:59:59:24.5', '00:00:00:00.0', 25], [0, 50]), ('boundary control', ['00:00:00:00.00', '00:00:00:01.50', 25], [1, 50]), ('normal control', ['23:59:00:24.5', '00:30:59:01.0', 25], [47951, 50]), ('normal control', ['23:30:00:00.0', '00:59:30:00.99', 30], [161100, 99]), ('normal control', ['23:59:59:29.05', '00:59:00:01.00', 30], [106201, 95])], [('regression: half-day tie', ['01:00:30:00.99', '23:30:00:29.50', 30], [-162871, -49]), ('regression variant: half-day tie', ['00:59:00:29.00', '00:00:00:01.05', 30], [-106227, -95]), ('partial repair probe: half-day tie', ['00:00:00:29.05', '12:00:00:29.05', 30], [1296000, 0]), ('partial repair variant: half-day tie', ['12:30:59:01.99', '00:30:59:01.99', 30], [1296000, 0]), ('boundary control', ['00:00:00:00.00', '00:00:00:01.50', 25], [1, 50]), ('boundary control', ['23:59:59:24.5', '00:00:00:00.0', 25], [0, 50]), ('normal control', ['23:00:00:00.05', '23:30:00:01.0', 30], [54000, 95]), ('normal control', ['00:30:00:01.0', '01:00:00:01.0', 30], [54000, 0]), ('normal control', ['00:59:00:01.50', '12:30:59:00.00', 25], [1037973, 50])], [('regression: half-day tie', ['01:59:30:29.50', '01:30:30:29.0', 30], [-52200, -50]), ('regression variant: half-day tie', ['00:59:30:01.5', '23:00:00:29.50', 30], [-215072, 0]), ('partial repair probe: half-day tie', ['00:59:59:01.05', '12:59:59:01.05', 30], [1296000, 0]), ('partial repair variant: half-day tie', ['00:59:00:24.00', '12:59:00:24.00', 25], [1080000, 0]), ('boundary control', ['23:59:59:24.5', '00:00:00:00.0', 25], [0, 50]), ('boundary control', ['00:00:00:00.00', '00:00:00:01.50', 25], [1, 50]), ('normal control', ['23:00:00:00.00', '01:00:30:01.0', 25], [180751, 0]), ('normal control', ['23:30:30:01.99', '23:59:59:01.05', 25], [44224, 6]), ('normal control', ['23:00:59:29.00', '00:30:00:00.50', 30], [160201, 50])], [('regression: half-day tie', ['12:59:30:01.50', '00:59:59:00.05', 30], [-1295131, -45]), ('regression variant: half-day tie', ['12:00:59:01.50', '01:00:00:01.05', 25], [-991475, -45]), ('partial repair probe: half-day tie', ['00:59:30:01.0', '12:59:30:01.0', 30], [1296000, 0]), ('partial repair variant: half-day tie', ['01:00:00:24.50', '13:00:00:24.50', 25], [1080000, 0]), ('boundary control', ['00:00:00:00.00', '00:00:00:01.50', 25], [1, 50]), ('boundary control', ['23:59:59:24.5', '00:00:00:00.0', 25], [0, 50]), ('normal control', ['00:59:00:24.0', '01:00:00:00.00', 25], [1476, 0]), ('normal control', ['01:00:00:01.5', '12:30:30:00.50', 30], [1242899, 0]), ('normal control', ['23:30:59:01.05', '01:30:30:00.99', 30], [215129, 94])]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
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 |
|---|---|---|---|
| regression: half-day tie | [-1, -50] | [-1, -50] | Passed |
| regression variant: half-day tie | [-52230, -45] | [-52230, -45] | Passed |
| partial repair probe: half-day tie | [-1296000, 0] | [1296000, 0] | Failed |
| partial repair variant: half-day tie | [-1080000, 0] | [1080000, 0] | Failed |
| boundary control | [1, 50] | [1, 50] | Passed |
| boundary control | [0, 50] | [0, 50] | Passed |
| normal control | [106259, 0] | [106259, 0] | Passed |
| normal control | [989273, 5] | [989273, 5] | Passed |
| normal control | [109771, 0] | [109771, 0] | Passed |
SHA-256 / a1943b382fd0e61358e001751cca872a8ae62f188cf8e65308af60ead5c19a8d
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(a, b, fps):
def parse(t):
main,sub=t.split('.')
h,m,s,f=map(int,main.split(':'))
return (((h*60+m)*60+s)*fps+f)*100+int(sub.ljust(2,'0'))
day=86400*fps*100
d=(parse(b)-parse(a))%day
if d>day//2:
d-=day
sign=-1 if d<0 else 1
q,r=divmod(abs(d),100)
return [sign*q,sign*r]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: half-day tie', ['00:00:00:01.50', '00:00:00:00.00', 25], [-1, -50]), ('regression variant: half-day tie', ['01:30:00:00.5', '01:00:59:00.05', 30], [-52230, -45]), ('partial repair probe: half-day tie', ['01:30:59:29.05', '13:30:59:29.05', 30], [1296000, 0]), ('partial repair variant: half-day tie', ['00:59:30:00.99', '12:59:30:00.99', 25], [1080000, 0]), ('boundary control', ['00:00:00:00.00', '00:00:00:01.50', 25], [1, 50]), ('boundary control', ['23:59:59:24.5', '00:00:00:00.0', 25], [0, 50]), ('normal control', ['00:59:59:00.5', '01:59:00:29.50', 30], [106259, 0]), ('normal control', ['12:30:30:01.00', '23:30:00:24.05', 25], [989273, 5]), ('normal control', ['23:00:00:00.99', '00:00:59:01.99', 30], [109771, 0])], [('regression: half-day tie', ['01:00:59:29.50', '00:30:30:29.99', 30], [-54869, -51]), ('regression variant: half-day tie', ['00:00:00:01.05', '23:00:00:01.05', 25], [-90000, 0]), ('partial repair probe: half-day tie', ['23:30:00:29.50', '11:30:00:29.50', 30], [1296000, 0]), ('partial repair variant: half-day tie', ['12:59:59:01.50', '00:59:59:01.50', 25], [1080000, 0]), ('boundary control', ['23:59:59:24.5', '00:00:00:00.0', 25], [0, 50]), ('boundary control', ['00:00:00:00.00', '00:00:00:01.50', 25], [1, 50]), ('normal control', ['23:59:00:24.5', '00:30:59:01.0', 25], [47951, 50]), ('normal control', ['23:30:00:00.0', '00:59:30:00.99', 30], [161100, 99]), ('normal control', ['23:59:59:29.05', '00:59:00:01.00', 30], [106201, 95])], [('regression: half-day tie', ['01:00:30:00.99', '23:30:00:29.50', 30], [-162871, -49]), ('regression variant: half-day tie', ['00:59:00:29.00', '00:00:00:01.05', 30], [-106227, -95]), ('partial repair probe: half-day tie', ['00:00:00:29.05', '12:00:00:29.05', 30], [1296000, 0]), ('partial repair variant: half-day tie', ['12:30:59:01.99', '00:30:59:01.99', 30], [1296000, 0]), ('boundary control', ['00:00:00:00.00', '00:00:00:01.50', 25], [1, 50]), ('boundary control', ['23:59:59:24.5', '00:00:00:00.0', 25], [0, 50]), ('normal control', ['23:00:00:00.05', '23:30:00:01.0', 30], [54000, 95]), ('normal control', ['00:30:00:01.0', '01:00:00:01.0', 30], [54000, 0]), ('normal control', ['00:59:00:01.50', '12:30:59:00.00', 25], [1037973, 50])], [('regression: half-day tie', ['01:59:30:29.50', '01:30:30:29.0', 30], [-52200, -50]), ('regression variant: half-day tie', ['00:59:30:01.5', '23:00:00:29.50', 30], [-215072, 0]), ('partial repair probe: half-day tie', ['00:59:59:01.05', '12:59:59:01.05', 30], [1296000, 0]), ('partial repair variant: half-day tie', ['00:59:00:24.00', '12:59:00:24.00', 25], [1080000, 0]), ('boundary control', ['23:59:59:24.5', '00:00:00:00.0', 25], [0, 50]), ('boundary control', ['00:00:00:00.00', '00:00:00:01.50', 25], [1, 50]), ('normal control', ['23:00:00:00.00', '01:00:30:01.0', 25], [180751, 0]), ('normal control', ['23:30:30:01.99', '23:59:59:01.05', 25], [44224, 6]), ('normal control', ['23:00:59:29.00', '00:30:00:00.50', 30], [160201, 50])], [('regression: half-day tie', ['12:59:30:01.50', '00:59:59:00.05', 30], [-1295131, -45]), ('regression variant: half-day tie', ['12:00:59:01.50', '01:00:00:01.05', 25], [-991475, -45]), ('partial repair probe: half-day tie', ['00:59:30:01.0', '12:59:30:01.0', 30], [1296000, 0]), ('partial repair variant: half-day tie', ['01:00:00:24.50', '13:00:00:24.50', 25], [1080000, 0]), ('boundary control', ['00:00:00:00.00', '00:00:00:01.50', 25], [1, 50]), ('boundary control', ['23:59:59:24.5', '00:00:00:00.0', 25], [0, 50]), ('normal control', ['00:59:00:24.0', '01:00:00:00.00', 25], [1476, 0]), ('normal control', ['01:00:00:01.5', '12:30:30:00.50', 30], [1242899, 0]), ('normal control', ['23:30:59:01.05', '01:30:30:00.99', 30], [215129, 94])]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
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 |
|---|---|---|---|
| regression: half-day tie | [-1, -50] | [-1, -50] | Passed |
| regression variant: half-day tie | [-52230, -45] | [-52230, -45] | Passed |
| partial repair probe: half-day tie | [1296000, 0] | [1296000, 0] | Passed |
| partial repair variant: half-day tie | [1080000, 0] | [1080000, 0] | Passed |
| boundary control | [1, 50] | [1, 50] | Passed |
| boundary control | [0, 50] | [0, 50] | Passed |
| normal control | [106259, 0] | [106259, 0] | Passed |
| normal control | [989273, 5] | [989273, 5] | Passed |
| normal control | [109771, 0] | [109771, 0] | Passed |
SHA-256 / 0a254a38f0ace7483fbf541bc58b596ad209c5b1de19c37626d846affdc7027d
Verification & scope
A deterministic bounded teaching model with a stipulated toy contract; it does not claim conformance to SMPTE or any broadcast standard. 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:49:38.604479+00:00.
Case digest / 459fe16e80db72b98a12fc0a88b37e527b7bfae876e3ba4eb5f303e1c1289ec1