FA-78771 / Broadcast timecode arithmetic / Open access
Operator timecode entry normalization: digit right alignment · case 01
Typing 100 jumps to 10:00:00:00 instead of one second.
ROOT CAUSE
Digit entry is padded on the right, left-aligning the digits.
THE FAILURE
Digit entry is padded on the right, left-aligning the digits.
Unsuccessful approach: Taking the first eight characters of the zero-padded string discards the typed digits.
Case contract
Normalize typed timecode. Separators ":", ";" and "." are equivalent. With separators, up to four numeric fields fill from the right (frames last). Without separators, up to eight digits are right-aligned into HH MM SS FF pairs. Field overflow carries through the total frame count, which wraps at 24 hours. Invalid entry returns None.
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(s, fps):
s=s.replace(';',':').replace('.',':')
if ':' in s:
parts=s.split(':')
if len(parts)>4 or not all(p.isdigit() for p in parts):
return None
vals=[0]*(4-len(parts))+[int(p) for p in parts]
else:
if not s.isdigit() or len(s)>8:
return None
d=s.ljust(8,'0')
vals=[int(d[i:i+2]) for i in range(0,8,2)]
h,m,sec,f=vals
n=((h*60+m)*60+sec)*fps+f
n%=86400*fps
return '%02d:%02d:%02d:%02d'%(n//(3600*fps),n//(60*fps)%60,n//fps%60,n%fps)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: digit right alignment', ['100', 25], '00:00:01:00'), ('regression variant: digit right alignment', ['5959', 24], '00:01:01:11'), ('partial repair probe: digit right alignment', ['23595924', 25], '23:59:59:24'), ('partial repair variant: digit right alignment', ['100', 24], '00:00:01:00'), ('boundary control', ['1:2', 25], '00:00:01:02'), ('boundary control', ['1.2.3.4', 25], '01:02:03:04'), ('normal control', ['59.10', 24], '00:00:59:10'), ('normal control', ['59.99', 24], '00:01:03:03'), ('normal control', ['59:23', 24], '00:00:59:23')], [('regression: digit right alignment', ['99', 25], '00:00:03:24'), ('regression variant: digit right alignment', ['10', 24], '00:00:00:10'), ('partial repair probe: digit right alignment', ['99', 24], '00:00:04:03'), ('partial repair variant: digit right alignment', ['10000', 25], '00:01:00:00'), ('boundary control', ['1.2.3.4', 25], '01:02:03:04'), ('boundary control', ['1:2', 25], '00:00:01:02'), ('normal control', ['99.24.0', 24], '01:39:24:00'), ('normal control', ['23:30:30', 24], '00:23:31:06'), ('normal control', ['59.2', 24], '00:00:59:02')], [('regression: digit right alignment', ['99', 24], '00:00:04:03'), ('regression variant: digit right alignment', ['100', 24], '00:00:01:00'), ('partial repair probe: digit right alignment', ['100', 30], '00:00:01:00'), ('partial repair variant: digit right alignment', ['5959', 30], '00:01:00:29'), ('boundary control', ['1:2', 25], '00:00:01:02'), ('boundary control', ['1.2.3.4', 25], '01:02:03:04'), ('normal control', ['1;1;1;99;2', 30], None), ('normal control', ['2;2;0;1;99', 30], None), ('normal control', ['23;1;1', 25], '00:23:01:01')], [('regression: digit right alignment', ['100', 30], '00:00:01:00'), ('regression variant: digit right alignment', ['10000', 25], '00:01:00:00'), ('partial repair probe: digit right alignment', ['10000', 24], '00:01:00:00'), ('partial repair variant: digit right alignment', ['30', 24], '00:00:01:06'), ('boundary control', ['1.2.3.4', 25], '01:02:03:04'), ('boundary control', ['1:2', 25], '00:00:01:02'), ('normal control', ['x1', 24], None), ('normal control', ['23.1', 30], '00:00:23:01'), ('normal control', ['23;1;99', 30], '00:23:04:09')], [('regression: digit right alignment', ['10000', 24], '00:01:00:00'), ('regression variant: digit right alignment', ['5959', 30], '00:01:00:29'), ('partial repair probe: digit right alignment', ['5959', 24], '00:01:01:11'), ('partial repair variant: digit right alignment', ['30', 30], '00:00:01:00'), ('boundary control', ['1:2', 25], '00:00:01:02'), ('boundary control', ['1.2.3.4', 25], '01:02:03:04'), ('normal control', ['59.99.23.24', 24], '12:39:24:00'), ('normal control', ['61:10:61', 24], '01:01:12:13'), ('normal control', ['30;24;61;30', 24], '06:25:02:06')]]
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: digit right alignment | 10:00:00:00 | 00:00:01:00 | Failed |
| regression variant: digit right alignment | 11:59:00:00 | 00:01:01:11 | Failed |
| partial repair probe: digit right alignment | 23:59:59:24 | 23:59:59:24 | Passed |
| partial repair variant: digit right alignment | 10:00:00:00 | 00:00:01:00 | Failed |
| boundary control | 00:00:01:02 | 00:00:01:02 | Passed |
| boundary control | 01:02:03:04 | 01:02:03:04 | Passed |
| normal control | 00:00:59:10 | 00:00:59:10 | Passed |
| normal control | 00:01:03:03 | 00:01:03:03 | Passed |
| normal control | 00:00:59:23 | 00:00:59:23 | Passed |
SHA-256 / c186a5947ad562a1d11a57118cce02c11527d05e8e10936b936a31f5c9f15238
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s, fps):
s=s.replace(';',':').replace('.',':')
if ':' in s:
parts=s.split(':')
if len(parts)>4 or not all(p.isdigit() for p in parts):
return None
vals=[0]*(4-len(parts))+[int(p) for p in parts]
else:
if not s.isdigit() or len(s)>8:
return None
d=('0'*8+s)[:8]
vals=[int(d[i:i+2]) for i in range(0,8,2)]
h,m,sec,f=vals
n=((h*60+m)*60+sec)*fps+f
n%=86400*fps
return '%02d:%02d:%02d:%02d'%(n//(3600*fps),n//(60*fps)%60,n//fps%60,n%fps)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: digit right alignment', ['100', 25], '00:00:01:00'), ('regression variant: digit right alignment', ['5959', 24], '00:01:01:11'), ('partial repair probe: digit right alignment', ['23595924', 25], '23:59:59:24'), ('partial repair variant: digit right alignment', ['100', 24], '00:00:01:00'), ('boundary control', ['1:2', 25], '00:00:01:02'), ('boundary control', ['1.2.3.4', 25], '01:02:03:04'), ('normal control', ['59.10', 24], '00:00:59:10'), ('normal control', ['59.99', 24], '00:01:03:03'), ('normal control', ['59:23', 24], '00:00:59:23')], [('regression: digit right alignment', ['99', 25], '00:00:03:24'), ('regression variant: digit right alignment', ['10', 24], '00:00:00:10'), ('partial repair probe: digit right alignment', ['99', 24], '00:00:04:03'), ('partial repair variant: digit right alignment', ['10000', 25], '00:01:00:00'), ('boundary control', ['1.2.3.4', 25], '01:02:03:04'), ('boundary control', ['1:2', 25], '00:00:01:02'), ('normal control', ['99.24.0', 24], '01:39:24:00'), ('normal control', ['23:30:30', 24], '00:23:31:06'), ('normal control', ['59.2', 24], '00:00:59:02')], [('regression: digit right alignment', ['99', 24], '00:00:04:03'), ('regression variant: digit right alignment', ['100', 24], '00:00:01:00'), ('partial repair probe: digit right alignment', ['100', 30], '00:00:01:00'), ('partial repair variant: digit right alignment', ['5959', 30], '00:01:00:29'), ('boundary control', ['1:2', 25], '00:00:01:02'), ('boundary control', ['1.2.3.4', 25], '01:02:03:04'), ('normal control', ['1;1;1;99;2', 30], None), ('normal control', ['2;2;0;1;99', 30], None), ('normal control', ['23;1;1', 25], '00:23:01:01')], [('regression: digit right alignment', ['100', 30], '00:00:01:00'), ('regression variant: digit right alignment', ['10000', 25], '00:01:00:00'), ('partial repair probe: digit right alignment', ['10000', 24], '00:01:00:00'), ('partial repair variant: digit right alignment', ['30', 24], '00:00:01:06'), ('boundary control', ['1.2.3.4', 25], '01:02:03:04'), ('boundary control', ['1:2', 25], '00:00:01:02'), ('normal control', ['x1', 24], None), ('normal control', ['23.1', 30], '00:00:23:01'), ('normal control', ['23;1;99', 30], '00:23:04:09')], [('regression: digit right alignment', ['10000', 24], '00:01:00:00'), ('regression variant: digit right alignment', ['5959', 30], '00:01:00:29'), ('partial repair probe: digit right alignment', ['5959', 24], '00:01:01:11'), ('partial repair variant: digit right alignment', ['30', 30], '00:00:01:00'), ('boundary control', ['1:2', 25], '00:00:01:02'), ('boundary control', ['1.2.3.4', 25], '01:02:03:04'), ('normal control', ['59.99.23.24', 24], '12:39:24:00'), ('normal control', ['61:10:61', 24], '01:01:12:13'), ('normal control', ['30;24;61;30', 24], '06:25:02:06')]]
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: digit right alignment | 00:00:00:00 | 00:00:01:00 | Failed |
| regression variant: digit right alignment | 00:00:00:00 | 00:01:01:11 | Failed |
| partial repair probe: digit right alignment | 00:00:00:00 | 23:59:59:24 | Failed |
| partial repair variant: digit right alignment | 00:00:00:00 | 00:00:01:00 | Failed |
| boundary control | 00:00:01:02 | 00:00:01:02 | Passed |
| boundary control | 01:02:03:04 | 01:02:03:04 | Passed |
| normal control | 00:00:59:10 | 00:00:59:10 | Passed |
| normal control | 00:01:03:03 | 00:01:03:03 | Passed |
| normal control | 00:00:59:23 | 00:00:59:23 | Passed |
SHA-256 / 31eea325f1e26fc298fc83d292a9756cdcc38c9a5928c5e715a99b9ca3e5f51a
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 9 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗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.562558+00:00.
Case digest / b1e2621d4d21ffff0dd09e5aca4944472a7d4537a44b7eca1716dfc739e8f17c