FA-78656 / Broadcast timecode arithmetic / Open access
Programme-relative signed timecode: magnitude for fields · case 01
Negative offsets are printed with garbled fields.
ROOT CAUSE
Negative offsets are split into fields without taking the magnitude.
VERIFIED REPAIR
Split the absolute offset into fields.
Unsuccessful approach: Wrapping the negative offset prints the complementary positive time.
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=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: magnitude for fields', ['00:59:30:00', '01:00:00:00', 25], '-00:00:30:00'), ('regression variant: magnitude for fields', ['23:00:59:15', '00:00:10:00', 30], '-00:59:10:15'), ('partial repair probe: magnitude for fields', ['12:59:59:24', '23:59:00:00', 25], '-10:59:00:01'), ('partial repair variant: magnitude for fields', ['23:59:59:15', '01:00:00:00', 30], '-01:00:00:15'), ('boundary control', ['00:01:00:00', '23:59:00:00', 25], '+00:02:00:00'), ('boundary control', ['01:00:00:00', '01:00:00:00', 30], '+00:00:00:00'), ('normal control', ['01:59:59:29', '23:59:00:00', 30], '+02:00:59:29'), ('normal control', ['00:59:30:00', '00:00:10:00', 25], '+00:59:20:00'), ('normal control', ['01:01:01:01', '01:00:00:00', 25], '+00:01:01:01')], [('regression: magnitude for fields', ['23:59:50:00', '00:00:10:00', 25], '-00:00:20:00'), ('regression variant: magnitude for fields', ['00:00:00:00', '00:00:10:00', 25], '-00:00:10:00'), ('partial repair probe: magnitude for fields', ['01:00:01:01', '10:00:00:00', 30], '-08:59:58:29'), ('partial repair variant: magnitude for fields', ['00:01:00:00', '01:00:00:00', 25], '-00:59:00:00'), ('boundary control', ['01:00:00:00', '01:00:00:00', 30], '+00:00:00:00'), ('boundary control', ['00:01:00:00', '23:59:00:00', 25], '+00:02:00:00'), ('normal control', ['00:59:30:00', '00:00:10:00', 30], '+00:59:20:00'), ('normal control', ['10:59:59:15', '01:00:00:00', 30], '+09:59:59:15'), ('normal control', ['01:01:01:00', '23:59:00:00', 25], '+01:02:01:00')], [('regression: magnitude for fields', ['22:00:00:00', '10:00:00:00', 30], '-12:00:00:00'), ('regression variant: magnitude for fields', ['00:01:59:15', '01:00:00:00', 30], '-00:58:00:15'), ('partial repair probe: magnitude for fields', ['23:00:59:15', '00:00:10:00', 30], '-00:59:10:15'), ('partial repair variant: magnitude for fields', ['00:00:00:00', '00:00:10:00', 30], '-00:00:10:00'), ('boundary control', ['00:01:00:00', '23:59:00:00', 25], '+00:02:00:00'), ('boundary control', ['01:00:00:00', '01:00:00:00', 30], '+00:00:00:00'), ('normal control', ['01:01:30:01', '01:00:00:00', 30], '+00:01:30:01'), ('normal control', ['01:00:00:00', '23:59:00:00', 30], '+01:01:00:00'), ('normal control', ['10:29:59:24', '00:00:10:00', 25], '+10:29:49:24')], [('regression: magnitude for fields', ['12:59:59:24', '23:59:00:00', 25], '-10:59:00:01'), ('regression variant: magnitude for fields', ['01:00:00:01', '10:00:00:00', 25], '-08:59:59:24'), ('partial repair probe: magnitude for fields', ['00:00:00:00', '00:00:10:00', 25], '-00:00:10:00'), ('partial repair variant: magnitude for fields', ['12:59:59:24', '00:00:10:00', 30], '-11:00:10:06'), ('boundary control', ['01:00:00:00', '01:00:00:00', 30], '+00:00:00:00'), ('boundary control', ['00:01:00:00', '23:59:00:00', 25], '+00:02:00:00'), ('normal control', ['01:00:30:01', '23:59:00:00', 25], '+01:01:30:01'), ('normal control', ['10:59:30:15', '10:00:00:00', 30], '+00:59:30:15'), ('normal control', ['10:00:30:00', '01:00:00:00', 25], '+09:00:30:00')], [('regression: magnitude for fields', ['01:00:01:01', '10:00:00:00', 30], '-08:59:58:29'), ('regression variant: magnitude for fields', ['00:00:00:00', '01:00:00:00', 30], '-01:00:00:00'), ('partial repair probe: magnitude for fields', ['00:01:59:15', '01:00:00:00', 30], '-00:58:00:15'), ('partial repair variant: magnitude for fields', ['22:00:00:00', '23:59:00:00', 25], '-01:59:00:00'), ('boundary control', ['00:01:00:00', '23:59:00:00', 25], '+00:02:00:00'), ('boundary control', ['01:00:00:00', '01:00:00:00', 30], '+00:00:00:00'), ('normal control', ['10:29:30:01', '01:00:00:00', 25], '+09:29:30:01'), ('normal control', ['11:59:59:00', '01:00:00:00', 30], '+10:59:59:00'), ('normal control', ['10:01:59:01', '23:59:00:00', 30], '+10:02:59:01')]]
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: magnitude for fields | --1:59:30:00 | -00:00:30:00 | Failed |
| regression variant: magnitude for fields | --1:00:49:15 | -00:59:10:15 | Failed |
| partial repair probe: magnitude for fields | --11:00:59:24 | -10:59:00:01 | Failed |
| partial repair variant: magnitude for fields | --2:59:59:15 | -01:00:00:15 | Failed |
| boundary control | +00:02:00:00 | +00:02:00:00 | Passed |
| boundary control | +00:00:00:00 | +00:00:00:00 | Passed |
| normal control | +02:00:59:29 | +02:00:59:29 | Passed |
| normal control | +00:59:20:00 | +00:59:20:00 | Passed |
| normal control | +00:01:01:01 | +00:01:01:01 | Passed |
SHA-256 / 2b12b19d0b525ad624b1a03863a857e0174c0d181301fb66d4d1416fecdf2827
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=d%day
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: magnitude for fields', ['00:59:30:00', '01:00:00:00', 25], '-00:00:30:00'), ('regression variant: magnitude for fields', ['23:00:59:15', '00:00:10:00', 30], '-00:59:10:15'), ('partial repair probe: magnitude for fields', ['12:59:59:24', '23:59:00:00', 25], '-10:59:00:01'), ('partial repair variant: magnitude for fields', ['23:59:59:15', '01:00:00:00', 30], '-01:00:00:15'), ('boundary control', ['00:01:00:00', '23:59:00:00', 25], '+00:02:00:00'), ('boundary control', ['01:00:00:00', '01:00:00:00', 30], '+00:00:00:00'), ('normal control', ['01:59:59:29', '23:59:00:00', 30], '+02:00:59:29'), ('normal control', ['00:59:30:00', '00:00:10:00', 25], '+00:59:20:00'), ('normal control', ['01:01:01:01', '01:00:00:00', 25], '+00:01:01:01')], [('regression: magnitude for fields', ['23:59:50:00', '00:00:10:00', 25], '-00:00:20:00'), ('regression variant: magnitude for fields', ['00:00:00:00', '00:00:10:00', 25], '-00:00:10:00'), ('partial repair probe: magnitude for fields', ['01:00:01:01', '10:00:00:00', 30], '-08:59:58:29'), ('partial repair variant: magnitude for fields', ['00:01:00:00', '01:00:00:00', 25], '-00:59:00:00'), ('boundary control', ['01:00:00:00', '01:00:00:00', 30], '+00:00:00:00'), ('boundary control', ['00:01:00:00', '23:59:00:00', 25], '+00:02:00:00'), ('normal control', ['00:59:30:00', '00:00:10:00', 30], '+00:59:20:00'), ('normal control', ['10:59:59:15', '01:00:00:00', 30], '+09:59:59:15'), ('normal control', ['01:01:01:00', '23:59:00:00', 25], '+01:02:01:00')], [('regression: magnitude for fields', ['22:00:00:00', '10:00:00:00', 30], '-12:00:00:00'), ('regression variant: magnitude for fields', ['00:01:59:15', '01:00:00:00', 30], '-00:58:00:15'), ('partial repair probe: magnitude for fields', ['23:00:59:15', '00:00:10:00', 30], '-00:59:10:15'), ('partial repair variant: magnitude for fields', ['00:00:00:00', '00:00:10:00', 30], '-00:00:10:00'), ('boundary control', ['00:01:00:00', '23:59:00:00', 25], '+00:02:00:00'), ('boundary control', ['01:00:00:00', '01:00:00:00', 30], '+00:00:00:00'), ('normal control', ['01:01:30:01', '01:00:00:00', 30], '+00:01:30:01'), ('normal control', ['01:00:00:00', '23:59:00:00', 30], '+01:01:00:00'), ('normal control', ['10:29:59:24', '00:00:10:00', 25], '+10:29:49:24')], [('regression: magnitude for fields', ['12:59:59:24', '23:59:00:00', 25], '-10:59:00:01'), ('regression variant: magnitude for fields', ['01:00:00:01', '10:00:00:00', 25], '-08:59:59:24'), ('partial repair probe: magnitude for fields', ['00:00:00:00', '00:00:10:00', 25], '-00:00:10:00'), ('partial repair variant: magnitude for fields', ['12:59:59:24', '00:00:10:00', 30], '-11:00:10:06'), ('boundary control', ['01:00:00:00', '01:00:00:00', 30], '+00:00:00:00'), ('boundary control', ['00:01:00:00', '23:59:00:00', 25], '+00:02:00:00'), ('normal control', ['01:00:30:01', '23:59:00:00', 25], '+01:01:30:01'), ('normal control', ['10:59:30:15', '10:00:00:00', 30], '+00:59:30:15'), ('normal control', ['10:00:30:00', '01:00:00:00', 25], '+09:00:30:00')], [('regression: magnitude for fields', ['01:00:01:01', '10:00:00:00', 30], '-08:59:58:29'), ('regression variant: magnitude for fields', ['00:00:00:00', '01:00:00:00', 30], '-01:00:00:00'), ('partial repair probe: magnitude for fields', ['00:01:59:15', '01:00:00:00', 30], '-00:58:00:15'), ('partial repair variant: magnitude for fields', ['22:00:00:00', '23:59:00:00', 25], '-01:59:00:00'), ('boundary control', ['00:01:00:00', '23:59:00:00', 25], '+00:02:00:00'), ('boundary control', ['01:00:00:00', '01:00:00:00', 30], '+00:00:00:00'), ('normal control', ['10:29:30:01', '01:00:00:00', 25], '+09:29:30:01'), ('normal control', ['11:59:59:00', '01:00:00:00', 30], '+10:59:59:00'), ('normal control', ['10:01:59:01', '23:59:00:00', 30], '+10:02:59:01')]]
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: magnitude for fields | -23:59:30:00 | -00:00:30:00 | Failed |
| regression variant: magnitude for fields | -23:00:49:15 | -00:59:10:15 | Failed |
| partial repair probe: magnitude for fields | -13:00:59:24 | -10:59:00:01 | Failed |
| partial repair variant: magnitude for fields | -22:59:59:15 | -01:00:00:15 | Failed |
| boundary control | +00:02:00:00 | +00:02:00:00 | Passed |
| boundary control | +00:00:00:00 | +00:00:00:00 | Passed |
| normal control | +02:00:59:29 | +02:00:59:29 | Passed |
| normal control | +00:59:20:00 | +00:59:20:00 | Passed |
| normal control | +00:01:01:01 | +00:01:01:01 | Passed |
SHA-256 / 9f48b0354e71099a45e5ceca937bd34494228169bc6c82b6b17ae005ad31e933
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: magnitude for fields', ['00:59:30:00', '01:00:00:00', 25], '-00:00:30:00'), ('regression variant: magnitude for fields', ['23:00:59:15', '00:00:10:00', 30], '-00:59:10:15'), ('partial repair probe: magnitude for fields', ['12:59:59:24', '23:59:00:00', 25], '-10:59:00:01'), ('partial repair variant: magnitude for fields', ['23:59:59:15', '01:00:00:00', 30], '-01:00:00:15'), ('boundary control', ['00:01:00:00', '23:59:00:00', 25], '+00:02:00:00'), ('boundary control', ['01:00:00:00', '01:00:00:00', 30], '+00:00:00:00'), ('normal control', ['01:59:59:29', '23:59:00:00', 30], '+02:00:59:29'), ('normal control', ['00:59:30:00', '00:00:10:00', 25], '+00:59:20:00'), ('normal control', ['01:01:01:01', '01:00:00:00', 25], '+00:01:01:01')], [('regression: magnitude for fields', ['23:59:50:00', '00:00:10:00', 25], '-00:00:20:00'), ('regression variant: magnitude for fields', ['00:00:00:00', '00:00:10:00', 25], '-00:00:10:00'), ('partial repair probe: magnitude for fields', ['01:00:01:01', '10:00:00:00', 30], '-08:59:58:29'), ('partial repair variant: magnitude for fields', ['00:01:00:00', '01:00:00:00', 25], '-00:59:00:00'), ('boundary control', ['01:00:00:00', '01:00:00:00', 30], '+00:00:00:00'), ('boundary control', ['00:01:00:00', '23:59:00:00', 25], '+00:02:00:00'), ('normal control', ['00:59:30:00', '00:00:10:00', 30], '+00:59:20:00'), ('normal control', ['10:59:59:15', '01:00:00:00', 30], '+09:59:59:15'), ('normal control', ['01:01:01:00', '23:59:00:00', 25], '+01:02:01:00')], [('regression: magnitude for fields', ['22:00:00:00', '10:00:00:00', 30], '-12:00:00:00'), ('regression variant: magnitude for fields', ['00:01:59:15', '01:00:00:00', 30], '-00:58:00:15'), ('partial repair probe: magnitude for fields', ['23:00:59:15', '00:00:10:00', 30], '-00:59:10:15'), ('partial repair variant: magnitude for fields', ['00:00:00:00', '00:00:10:00', 30], '-00:00:10:00'), ('boundary control', ['00:01:00:00', '23:59:00:00', 25], '+00:02:00:00'), ('boundary control', ['01:00:00:00', '01:00:00:00', 30], '+00:00:00:00'), ('normal control', ['01:01:30:01', '01:00:00:00', 30], '+00:01:30:01'), ('normal control', ['01:00:00:00', '23:59:00:00', 30], '+01:01:00:00'), ('normal control', ['10:29:59:24', '00:00:10:00', 25], '+10:29:49:24')], [('regression: magnitude for fields', ['12:59:59:24', '23:59:00:00', 25], '-10:59:00:01'), ('regression variant: magnitude for fields', ['01:00:00:01', '10:00:00:00', 25], '-08:59:59:24'), ('partial repair probe: magnitude for fields', ['00:00:00:00', '00:00:10:00', 25], '-00:00:10:00'), ('partial repair variant: magnitude for fields', ['12:59:59:24', '00:00:10:00', 30], '-11:00:10:06'), ('boundary control', ['01:00:00:00', '01:00:00:00', 30], '+00:00:00:00'), ('boundary control', ['00:01:00:00', '23:59:00:00', 25], '+00:02:00:00'), ('normal control', ['01:00:30:01', '23:59:00:00', 25], '+01:01:30:01'), ('normal control', ['10:59:30:15', '10:00:00:00', 30], '+00:59:30:15'), ('normal control', ['10:00:30:00', '01:00:00:00', 25], '+09:00:30:00')], [('regression: magnitude for fields', ['01:00:01:01', '10:00:00:00', 30], '-08:59:58:29'), ('regression variant: magnitude for fields', ['00:00:00:00', '01:00:00:00', 30], '-01:00:00:00'), ('partial repair probe: magnitude for fields', ['00:01:59:15', '01:00:00:00', 30], '-00:58:00:15'), ('partial repair variant: magnitude for fields', ['22:00:00:00', '23:59:00:00', 25], '-01:59:00:00'), ('boundary control', ['00:01:00:00', '23:59:00:00', 25], '+00:02:00:00'), ('boundary control', ['01:00:00:00', '01:00:00:00', 30], '+00:00:00:00'), ('normal control', ['10:29:30:01', '01:00:00:00', 25], '+09:29:30:01'), ('normal control', ['11:59:59:00', '01:00:00:00', 30], '+10:59:59:00'), ('normal control', ['10:01:59:01', '23:59:00:00', 30], '+10:02:59:01')]]
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: magnitude for fields | -00:00:30:00 | -00:00:30:00 | Passed |
| regression variant: magnitude for fields | -00:59:10:15 | -00:59:10:15 | Passed |
| partial repair probe: magnitude for fields | -10:59:00:01 | -10:59:00:01 | Passed |
| partial repair variant: magnitude for fields | -01:00:00:15 | -01:00:00:15 | Passed |
| boundary control | +00:02:00:00 | +00:02:00:00 | Passed |
| boundary control | +00:00:00:00 | +00:00:00:00 | Passed |
| normal control | +02:00:59:29 | +02:00:59:29 | Passed |
| normal control | +00:59:20:00 | +00:59:20:00 | Passed |
| normal control | +00:01:01:01 | +00:01:01:01 | Passed |
SHA-256 / 7c903c05d455e8263634fb7161d97100f309125c1d89622efe8e3f68256201e0
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.338049+00:00.
Case digest / 3eb308c21e96bf042cc9200a05ec477250f178df8ec6f209011a1dd56800e7de