FA-78651 / Broadcast timecode arithmetic / Open access
Programme-relative signed timecode: zero sign · case 01
The programme start itself is labelled -00:00:00:00.
ROOT CAUSE
Zero is treated as negative.
VERIFIED REPAIR
Use "+" for zero and positive offsets.
Unsuccessful approach: Omitting the plus sign breaks the fixed signed format.
Case contract
Express label tc relative to programme start as "+HH:MM:SS:FF" or "-HH:MM:SS:FF" along the shorter way round the 24-hour clock (an offset of exactly 12 hours is negative). Zero is "+".
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(tc, start, fps):
def fr(t):
h,m,s,f=map(int,t.split(':'))
return ((h*60+m)*60+s)*fps+f
day=86400*fps
d=(fr(tc)-fr(start))%day
if d>=day//2:
d-=day
sign='-' if d<=0 else '+'
a=abs(d)
return '%s%02d:%02d:%02d:%02d'%(sign,a//(3600*fps),a//(60*fps)%60,a//fps%60,a%fps)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: zero sign', ['01:00:00:00', '01:00:00:00', 30], '+00:00:00:00'), ('regression variant: zero sign', ['00:00:10:00', '00:00:10:00', 25], '+00:00:00:00'), ('partial repair probe: zero sign', ['01:59:59:29', '23:59:00:00', 30], '+02:00:59:29'), ('partial repair variant: zero sign', ['12:59:59:24', '01:00:00:00', 30], '+11:59:59:24'), ('boundary control', ['00:59:30:00', '01:00:00:00', 25], '-00:00:30:00'), ('boundary control', ['23:59:50:00', '00:00:10:00', 25], '-00:00:20:00'), ('normal control', ['22:00:00:00', '10:00:00:00', 30], '-12:00:00:00'), ('normal control', ['12:59:59:24', '23:59:00:00', 25], '-10:59:00:01'), ('normal control', ['23:00:59:15', '00:00:10:00', 30], '-00:59:10:15')], [('regression: zero sign', ['01:00:00:00', '01:00:00:00', 25], '+00:00:00:00'), ('regression variant: zero sign', ['23:59:00:00', '23:59:00:00', 30], '+00:00:00:00'), ('partial repair probe: zero sign', ['00:59:30:00', '00:00:10:00', 25], '+00:59:20:00'), ('partial repair variant: zero sign', ['10:59:59:15', '01:00:00:00', 30], '+09:59:59:15'), ('boundary control', ['23:59:50:00', '00:00:10:00', 25], '-00:00:20:00'), ('boundary control', ['00:59:30:00', '01:00:00:00', 25], '-00:00:30:00'), ('normal control', ['00:01:59:15', '01:00:00:00', 30], '-00:58:00:15'), ('normal control', ['23:59:59:15', '01:00:00:00', 30], '-01:00:00:15'), ('normal control', ['00:00:00:00', '00:00:10:00', 30], '-00:00:10:00')], [('regression: zero sign', ['10:00:00:00', '10:00:00:00', 25], '+00:00:00:00'), ('regression variant: zero sign', ['10:00:00:00', '10:00:00:00', 30], '+00:00:00:00'), ('partial repair probe: zero sign', ['11:59:59:00', '01:00:00:00', 25], '+10:59:59:00'), ('partial repair variant: zero sign', ['00:00:10:00', '00:00:10:00', 30], '+00:00:00:00'), ('boundary control', ['00:59:30:00', '01:00:00:00', 25], '-00:00:30:00'), ('boundary control', ['23:59:50:00', '00:00:10:00', 25], '-00:00:20:00'), ('normal control', ['22:00:00:00', '23:59:00:00', 25], '-01:59:00:00'), ('normal control', ['23:01:59:12', '10:00:00:00', 25], '-10:58:00:13'), ('normal control', ['00:01:00:00', '01:00:00:00', 30], '-00:59:00:00')], [('regression: zero sign', ['00:00:10:00', '00:00:10:00', 30], '+00:00:00:00'), ('regression variant: zero sign', ['01:00:00:00', '01:00:00:00', 30], '+00:00:00:00'), ('partial repair probe: zero sign', ['01:01:01:01', '01:00:00:00', 25], '+00:01:01:01'), ('partial repair variant: zero sign', ['01:01:01:00', '23:59:00:00', 25], '+01:02:01:00'), ('boundary control', ['23:59:50:00', '00:00:10:00', 25], '-00:00:20:00'), ('boundary control', ['00:59:30:00', '01:00:00:00', 25], '-00:00:30:00'), ('normal control', ['00:59:01:00', '10:00:00:00', 25], '-09:00:59:00'), ('normal control', ['13:00:00:00', '23:59:00:00', 30], '-10:59:00:00'), ('normal control', ['00:01:00:01', '10:00:00:00', 25], '-09:58:59:24')], [('regression: zero sign', ['23:59:00:00', '23:59:00:00', 25], '+00:00:00:00'), ('regression variant: zero sign', ['01:00:00:00', '01:00:00:00', 25], '+00:00:00:00'), ('partial repair probe: zero sign', ['00:59:30:00', '00:00:10:00', 30], '+00:59:20:00'), ('partial repair variant: zero sign', ['01:01:30:01', '01:00:00:00', 30], '+00:01:30:01'), ('boundary control', ['00:59:30:00', '01:00:00:00', 25], '-00:00:30:00'), ('boundary control', ['23:59:50:00', '00:00:10:00', 25], '-00:00:20:00'), ('normal control', ['23:59:50:00', '01:00:00:00', 30], '-01:00:10:00'), ('normal control', ['23:01:01:12', '00:00:10:00', 25], '-00:59:08:13'), ('normal control', ['23:29:30:15', '00:00:10:00', 30], '-00:30:39:15')]]
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: zero sign | -00:00:00:00 | +00:00:00:00 | Failed |
| regression variant: zero sign | -00:00:00:00 | +00:00:00:00 | Failed |
| partial repair probe: zero sign | +02:00:59:29 | +02:00:59:29 | Passed |
| partial repair variant: zero sign | +11:59:59:24 | +11:59:59:24 | Passed |
| boundary control | -00:00:30:00 | -00:00:30:00 | Passed |
| boundary control | -00:00:20:00 | -00:00:20:00 | Passed |
| normal control | -12:00:00:00 | -12:00:00:00 | Passed |
| normal control | -10:59:00:01 | -10:59:00:01 | Passed |
| normal control | -00:59:10:15 | -00:59:10:15 | Passed |
SHA-256 / 8c70cff6b8bc685428494d472c5b84bd99454c233ce906c6556f84ec825c3945
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(tc, start, fps):
def fr(t):
h,m,s,f=map(int,t.split(':'))
return ((h*60+m)*60+s)*fps+f
day=86400*fps
d=(fr(tc)-fr(start))%day
if d>=day//2:
d-=day
sign='' if d>=0 else '-'
a=abs(d)
return '%s%02d:%02d:%02d:%02d'%(sign,a//(3600*fps),a//(60*fps)%60,a//fps%60,a%fps)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: zero sign', ['01:00:00:00', '01:00:00:00', 30], '+00:00:00:00'), ('regression variant: zero sign', ['00:00:10:00', '00:00:10:00', 25], '+00:00:00:00'), ('partial repair probe: zero sign', ['01:59:59:29', '23:59:00:00', 30], '+02:00:59:29'), ('partial repair variant: zero sign', ['12:59:59:24', '01:00:00:00', 30], '+11:59:59:24'), ('boundary control', ['00:59:30:00', '01:00:00:00', 25], '-00:00:30:00'), ('boundary control', ['23:59:50:00', '00:00:10:00', 25], '-00:00:20:00'), ('normal control', ['22:00:00:00', '10:00:00:00', 30], '-12:00:00:00'), ('normal control', ['12:59:59:24', '23:59:00:00', 25], '-10:59:00:01'), ('normal control', ['23:00:59:15', '00:00:10:00', 30], '-00:59:10:15')], [('regression: zero sign', ['01:00:00:00', '01:00:00:00', 25], '+00:00:00:00'), ('regression variant: zero sign', ['23:59:00:00', '23:59:00:00', 30], '+00:00:00:00'), ('partial repair probe: zero sign', ['00:59:30:00', '00:00:10:00', 25], '+00:59:20:00'), ('partial repair variant: zero sign', ['10:59:59:15', '01:00:00:00', 30], '+09:59:59:15'), ('boundary control', ['23:59:50:00', '00:00:10:00', 25], '-00:00:20:00'), ('boundary control', ['00:59:30:00', '01:00:00:00', 25], '-00:00:30:00'), ('normal control', ['00:01:59:15', '01:00:00:00', 30], '-00:58:00:15'), ('normal control', ['23:59:59:15', '01:00:00:00', 30], '-01:00:00:15'), ('normal control', ['00:00:00:00', '00:00:10:00', 30], '-00:00:10:00')], [('regression: zero sign', ['10:00:00:00', '10:00:00:00', 25], '+00:00:00:00'), ('regression variant: zero sign', ['10:00:00:00', '10:00:00:00', 30], '+00:00:00:00'), ('partial repair probe: zero sign', ['11:59:59:00', '01:00:00:00', 25], '+10:59:59:00'), ('partial repair variant: zero sign', ['00:00:10:00', '00:00:10:00', 30], '+00:00:00:00'), ('boundary control', ['00:59:30:00', '01:00:00:00', 25], '-00:00:30:00'), ('boundary control', ['23:59:50:00', '00:00:10:00', 25], '-00:00:20:00'), ('normal control', ['22:00:00:00', '23:59:00:00', 25], '-01:59:00:00'), ('normal control', ['23:01:59:12', '10:00:00:00', 25], '-10:58:00:13'), ('normal control', ['00:01:00:00', '01:00:00:00', 30], '-00:59:00:00')], [('regression: zero sign', ['00:00:10:00', '00:00:10:00', 30], '+00:00:00:00'), ('regression variant: zero sign', ['01:00:00:00', '01:00:00:00', 30], '+00:00:00:00'), ('partial repair probe: zero sign', ['01:01:01:01', '01:00:00:00', 25], '+00:01:01:01'), ('partial repair variant: zero sign', ['01:01:01:00', '23:59:00:00', 25], '+01:02:01:00'), ('boundary control', ['23:59:50:00', '00:00:10:00', 25], '-00:00:20:00'), ('boundary control', ['00:59:30:00', '01:00:00:00', 25], '-00:00:30:00'), ('normal control', ['00:59:01:00', '10:00:00:00', 25], '-09:00:59:00'), ('normal control', ['13:00:00:00', '23:59:00:00', 30], '-10:59:00:00'), ('normal control', ['00:01:00:01', '10:00:00:00', 25], '-09:58:59:24')], [('regression: zero sign', ['23:59:00:00', '23:59:00:00', 25], '+00:00:00:00'), ('regression variant: zero sign', ['01:00:00:00', '01:00:00:00', 25], '+00:00:00:00'), ('partial repair probe: zero sign', ['00:59:30:00', '00:00:10:00', 30], '+00:59:20:00'), ('partial repair variant: zero sign', ['01:01:30:01', '01:00:00:00', 30], '+00:01:30:01'), ('boundary control', ['00:59:30:00', '01:00:00:00', 25], '-00:00:30:00'), ('boundary control', ['23:59:50:00', '00:00:10:00', 25], '-00:00:20:00'), ('normal control', ['23:59:50:00', '01:00:00:00', 30], '-01:00:10:00'), ('normal control', ['23:01:01:12', '00:00:10:00', 25], '-00:59:08:13'), ('normal control', ['23:29:30:15', '00:00:10:00', 30], '-00:30:39:15')]]
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: zero sign | 00:00:00:00 | +00:00:00:00 | Failed |
| regression variant: zero sign | 00:00:00:00 | +00:00:00:00 | Failed |
| partial repair probe: zero sign | 02:00:59:29 | +02:00:59:29 | Failed |
| partial repair variant: zero sign | 11:59:59:24 | +11:59:59:24 | Failed |
| boundary control | -00:00:30:00 | -00:00:30:00 | Passed |
| boundary control | -00:00:20:00 | -00:00:20:00 | Passed |
| normal control | -12:00:00:00 | -12:00:00:00 | Passed |
| normal control | -10:59:00:01 | -10:59:00:01 | Passed |
| normal control | -00:59:10:15 | -00:59:10:15 | Passed |
SHA-256 / 5834e4d3e68c873b1fdd891cea27634b647b51106a07fca27e58241b079c1329
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(tc, start, fps):
def fr(t):
h,m,s,f=map(int,t.split(':'))
return ((h*60+m)*60+s)*fps+f
day=86400*fps
d=(fr(tc)-fr(start))%day
if d>=day//2:
d-=day
sign='-' if d<0 else '+'
a=abs(d)
return '%s%02d:%02d:%02d:%02d'%(sign,a//(3600*fps),a//(60*fps)%60,a//fps%60,a%fps)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: zero sign', ['01:00:00:00', '01:00:00:00', 30], '+00:00:00:00'), ('regression variant: zero sign', ['00:00:10:00', '00:00:10:00', 25], '+00:00:00:00'), ('partial repair probe: zero sign', ['01:59:59:29', '23:59:00:00', 30], '+02:00:59:29'), ('partial repair variant: zero sign', ['12:59:59:24', '01:00:00:00', 30], '+11:59:59:24'), ('boundary control', ['00:59:30:00', '01:00:00:00', 25], '-00:00:30:00'), ('boundary control', ['23:59:50:00', '00:00:10:00', 25], '-00:00:20:00'), ('normal control', ['22:00:00:00', '10:00:00:00', 30], '-12:00:00:00'), ('normal control', ['12:59:59:24', '23:59:00:00', 25], '-10:59:00:01'), ('normal control', ['23:00:59:15', '00:00:10:00', 30], '-00:59:10:15')], [('regression: zero sign', ['01:00:00:00', '01:00:00:00', 25], '+00:00:00:00'), ('regression variant: zero sign', ['23:59:00:00', '23:59:00:00', 30], '+00:00:00:00'), ('partial repair probe: zero sign', ['00:59:30:00', '00:00:10:00', 25], '+00:59:20:00'), ('partial repair variant: zero sign', ['10:59:59:15', '01:00:00:00', 30], '+09:59:59:15'), ('boundary control', ['23:59:50:00', '00:00:10:00', 25], '-00:00:20:00'), ('boundary control', ['00:59:30:00', '01:00:00:00', 25], '-00:00:30:00'), ('normal control', ['00:01:59:15', '01:00:00:00', 30], '-00:58:00:15'), ('normal control', ['23:59:59:15', '01:00:00:00', 30], '-01:00:00:15'), ('normal control', ['00:00:00:00', '00:00:10:00', 30], '-00:00:10:00')], [('regression: zero sign', ['10:00:00:00', '10:00:00:00', 25], '+00:00:00:00'), ('regression variant: zero sign', ['10:00:00:00', '10:00:00:00', 30], '+00:00:00:00'), ('partial repair probe: zero sign', ['11:59:59:00', '01:00:00:00', 25], '+10:59:59:00'), ('partial repair variant: zero sign', ['00:00:10:00', '00:00:10:00', 30], '+00:00:00:00'), ('boundary control', ['00:59:30:00', '01:00:00:00', 25], '-00:00:30:00'), ('boundary control', ['23:59:50:00', '00:00:10:00', 25], '-00:00:20:00'), ('normal control', ['22:00:00:00', '23:59:00:00', 25], '-01:59:00:00'), ('normal control', ['23:01:59:12', '10:00:00:00', 25], '-10:58:00:13'), ('normal control', ['00:01:00:00', '01:00:00:00', 30], '-00:59:00:00')], [('regression: zero sign', ['00:00:10:00', '00:00:10:00', 30], '+00:00:00:00'), ('regression variant: zero sign', ['01:00:00:00', '01:00:00:00', 30], '+00:00:00:00'), ('partial repair probe: zero sign', ['01:01:01:01', '01:00:00:00', 25], '+00:01:01:01'), ('partial repair variant: zero sign', ['01:01:01:00', '23:59:00:00', 25], '+01:02:01:00'), ('boundary control', ['23:59:50:00', '00:00:10:00', 25], '-00:00:20:00'), ('boundary control', ['00:59:30:00', '01:00:00:00', 25], '-00:00:30:00'), ('normal control', ['00:59:01:00', '10:00:00:00', 25], '-09:00:59:00'), ('normal control', ['13:00:00:00', '23:59:00:00', 30], '-10:59:00:00'), ('normal control', ['00:01:00:01', '10:00:00:00', 25], '-09:58:59:24')], [('regression: zero sign', ['23:59:00:00', '23:59:00:00', 25], '+00:00:00:00'), ('regression variant: zero sign', ['01:00:00:00', '01:00:00:00', 25], '+00:00:00:00'), ('partial repair probe: zero sign', ['00:59:30:00', '00:00:10:00', 30], '+00:59:20:00'), ('partial repair variant: zero sign', ['01:01:30:01', '01:00:00:00', 30], '+00:01:30:01'), ('boundary control', ['00:59:30:00', '01:00:00:00', 25], '-00:00:30:00'), ('boundary control', ['23:59:50:00', '00:00:10:00', 25], '-00:00:20:00'), ('normal control', ['23:59:50:00', '01:00:00:00', 30], '-01:00:10:00'), ('normal control', ['23:01:01:12', '00:00:10:00', 25], '-00:59:08:13'), ('normal control', ['23:29:30:15', '00:00:10:00', 30], '-00:30:39:15')]]
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: zero sign | +00:00:00:00 | +00:00:00:00 | Passed |
| regression variant: zero sign | +00:00:00:00 | +00:00:00:00 | Passed |
| partial repair probe: zero sign | +02:00:59:29 | +02:00:59:29 | Passed |
| partial repair variant: zero sign | +11:59:59:24 | +11:59:59:24 | Passed |
| boundary control | -00:00:30:00 | -00:00:30:00 | Passed |
| boundary control | -00:00:20:00 | -00:00:20:00 | Passed |
| normal control | -12:00:00:00 | -12:00:00:00 | Passed |
| normal control | -10:59:00:01 | -10:59:00:01 | Passed |
| normal control | -00:59:10:15 | -00:59:10:15 | Passed |
SHA-256 / 9fe1520a791c85c6be68c94f236ec49485050a99b89b90e49f8309d9f059bb83
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:37.333165+00:00.
Case digest / b52497885cd447faf77b3182013f1d24a1f8a32d16eda10c35bfac2b8f5d1510