FAILURE MAP
← Case archive

FA-78781 / Broadcast timecode arithmetic / Open access

Operator timecode entry normalization: field fill side · case 01

Typing 1:2 gives one hour and two minutes instead of one second and two frames.

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

ROOT CAUSE

Separated fields are filled from the left.

VERIFIED REPAIR

Fill separated fields from the right, frames last.

Unsuccessful approach: Keeping only the last field as frames still places the others from the left.

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=[int(p) for p in parts]+[0]*(4-len(parts))
    else:
        if not s.isdigit() or len(s)>8:
            return None
        d=s.zfill(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: field fill side', ['1:2', 25], '00:00:01:02'), ('regression variant: field fill side', ['99.24.0', 24], '01:39:24:00'), ('partial repair probe: field fill side', ['59.99', 24], '00:01:03:03'), ('partial repair variant: field fill side', ['1:30:10', 30], '00:01:30:10'), ('boundary control', ['100', 25], '00:00:01:00'), ('boundary control', ['23595924', 25], '23:59:59:24'), ('normal control', ['99', 25], '00:00:03:24'), ('normal control', ['99', 24], '00:00:04:03'), ('normal control', ['100', 30], '00:00:01:00')], [('regression: field fill side', ['59.10', 24], '00:00:59:10'), ('regression variant: field fill side', ['23:30:30', 24], '00:23:31:06'), ('partial repair probe: field fill side', ['0:23:23', 24], '00:00:23:23'), ('partial repair variant: field fill side', ['59:59:2', 30], '00:59:59:02'), ('boundary control', ['99', 25], '00:00:03:24'), ('boundary control', ['100', 25], '00:00:01:00'), ('normal control', ['5959', 24], '00:01:01:11'), ('normal control', ['', 25], None), ('normal control', ['10000', 25], '00:01:00:00')], [('regression: field fill side', ['59.99', 24], '00:01:03:03'), ('regression variant: field fill side', ['59.23.99', 30], '00:59:26:09'), ('partial repair probe: field fill side', ['59:23', 24], '00:00:59:23'), ('partial repair variant: field fill side', ['23;1;1', 25], '00:23:01:01'), ('boundary control', ['1.2.3.4', 25], '01:02:03:04'), ('boundary control', ['99', 25], '00:00:03:24'), ('normal control', ['30', 24], '00:00:01:06'), ('normal control', ['1000', 24], '00:00:10:00'), ('normal control', ['2:23:61:99', 25], '02:24:04:24')], [('regression: field fill side', ['0:23:23', 24], '00:00:23:23'), ('regression variant: field fill side', ['59.2', 24], '00:00:59:02'), ('partial repair probe: field fill side', ['99.24.0', 24], '01:39:24:00'), ('partial repair variant: field fill side', ['10:30', 30], '00:00:11:00'), ('boundary control', ['23595924', 25], '23:59:59:24'), ('boundary control', ['1.2.3.4', 25], '01:02:03:04'), ('normal control', ['123456', 25], '00:12:36:06'), ('normal control', ['123456789', 25], None), ('normal control', ['x1', 24], None)], [('regression: field fill side', ['59:23', 24], '00:00:59:23'), ('regression variant: field fill side', ['1:30:10', 30], '00:01:30:10'), ('partial repair probe: field fill side', ['23:30:30', 24], '00:23:31:06'), ('partial repair variant: field fill side', ['23:59', 25], '00:00:25:09'), ('boundary control', ['100', 25], '00:00:01:00'), ('boundary control', ['23595924', 25], '23:59:59:24'), ('normal control', ['0:61:99:1:0', 30], None), ('normal control', ['59:23:23:10:10', 30], None), ('normal control', ['59.99.23.24', 24], '12:39:24:00')]]
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 fixtureActualExpectedOutcome
regression: field fill side01:02:00:0000:00:01:02Failed
regression variant: field fill side03:24:00:0001:39:24:00Failed
partial repair probe: field fill side12:39:00:0000:01:03:03Failed
partial repair variant: field fill side01:30:10:0000:01:30:10Failed
boundary control00:00:01:0000:00:01:00Passed
boundary control23:59:59:2423:59:59:24Passed
normal control00:00:03:2400:00:03:24Passed
normal control00:00:04:0300:00:04:03Passed
normal control00:00:01:0000:00:01:00Passed

SHA-256 / ebfd4d3ea645f5e38ffe64591d31f305891918cf71f96f20294c758faeb85a3e

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=[int(p) for p in parts[:-1]]+[0]*(4-len(parts))+[int(parts[-1])]
    else:
        if not s.isdigit() or len(s)>8:
            return None
        d=s.zfill(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: field fill side', ['1:2', 25], '00:00:01:02'), ('regression variant: field fill side', ['99.24.0', 24], '01:39:24:00'), ('partial repair probe: field fill side', ['59.99', 24], '00:01:03:03'), ('partial repair variant: field fill side', ['1:30:10', 30], '00:01:30:10'), ('boundary control', ['100', 25], '00:00:01:00'), ('boundary control', ['23595924', 25], '23:59:59:24'), ('normal control', ['99', 25], '00:00:03:24'), ('normal control', ['99', 24], '00:00:04:03'), ('normal control', ['100', 30], '00:00:01:00')], [('regression: field fill side', ['59.10', 24], '00:00:59:10'), ('regression variant: field fill side', ['23:30:30', 24], '00:23:31:06'), ('partial repair probe: field fill side', ['0:23:23', 24], '00:00:23:23'), ('partial repair variant: field fill side', ['59:59:2', 30], '00:59:59:02'), ('boundary control', ['99', 25], '00:00:03:24'), ('boundary control', ['100', 25], '00:00:01:00'), ('normal control', ['5959', 24], '00:01:01:11'), ('normal control', ['', 25], None), ('normal control', ['10000', 25], '00:01:00:00')], [('regression: field fill side', ['59.99', 24], '00:01:03:03'), ('regression variant: field fill side', ['59.23.99', 30], '00:59:26:09'), ('partial repair probe: field fill side', ['59:23', 24], '00:00:59:23'), ('partial repair variant: field fill side', ['23;1;1', 25], '00:23:01:01'), ('boundary control', ['1.2.3.4', 25], '01:02:03:04'), ('boundary control', ['99', 25], '00:00:03:24'), ('normal control', ['30', 24], '00:00:01:06'), ('normal control', ['1000', 24], '00:00:10:00'), ('normal control', ['2:23:61:99', 25], '02:24:04:24')], [('regression: field fill side', ['0:23:23', 24], '00:00:23:23'), ('regression variant: field fill side', ['59.2', 24], '00:00:59:02'), ('partial repair probe: field fill side', ['99.24.0', 24], '01:39:24:00'), ('partial repair variant: field fill side', ['10:30', 30], '00:00:11:00'), ('boundary control', ['23595924', 25], '23:59:59:24'), ('boundary control', ['1.2.3.4', 25], '01:02:03:04'), ('normal control', ['123456', 25], '00:12:36:06'), ('normal control', ['123456789', 25], None), ('normal control', ['x1', 24], None)], [('regression: field fill side', ['59:23', 24], '00:00:59:23'), ('regression variant: field fill side', ['1:30:10', 30], '00:01:30:10'), ('partial repair probe: field fill side', ['23:30:30', 24], '00:23:31:06'), ('partial repair variant: field fill side', ['23:59', 25], '00:00:25:09'), ('boundary control', ['100', 25], '00:00:01:00'), ('boundary control', ['23595924', 25], '23:59:59:24'), ('normal control', ['0:61:99:1:0', 30], None), ('normal control', ['59:23:23:10:10', 30], None), ('normal control', ['59.99.23.24', 24], '12:39:24:00')]]
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 fixtureActualExpectedOutcome
regression: field fill side01:00:00:0200:00:01:02Failed
regression variant: field fill side03:24:00:0001:39:24:00Failed
partial repair probe: field fill side11:00:04:0300:01:03:03Failed
partial repair variant: field fill side01:30:00:1000:01:30:10Failed
boundary control00:00:01:0000:00:01:00Passed
boundary control23:59:59:2423:59:59:24Passed
normal control00:00:03:2400:00:03:24Passed
normal control00:00:04:0300:00:04:03Passed
normal control00:00:01:0000:00:01:00Passed

SHA-256 / 8b6eb9b82673385efcff9f49d71dc03a84099371ddf147774288900c869a5a71

3 / The verified repair

Exit 0
"""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.zfill(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: field fill side', ['1:2', 25], '00:00:01:02'), ('regression variant: field fill side', ['99.24.0', 24], '01:39:24:00'), ('partial repair probe: field fill side', ['59.99', 24], '00:01:03:03'), ('partial repair variant: field fill side', ['1:30:10', 30], '00:01:30:10'), ('boundary control', ['100', 25], '00:00:01:00'), ('boundary control', ['23595924', 25], '23:59:59:24'), ('normal control', ['99', 25], '00:00:03:24'), ('normal control', ['99', 24], '00:00:04:03'), ('normal control', ['100', 30], '00:00:01:00')], [('regression: field fill side', ['59.10', 24], '00:00:59:10'), ('regression variant: field fill side', ['23:30:30', 24], '00:23:31:06'), ('partial repair probe: field fill side', ['0:23:23', 24], '00:00:23:23'), ('partial repair variant: field fill side', ['59:59:2', 30], '00:59:59:02'), ('boundary control', ['99', 25], '00:00:03:24'), ('boundary control', ['100', 25], '00:00:01:00'), ('normal control', ['5959', 24], '00:01:01:11'), ('normal control', ['', 25], None), ('normal control', ['10000', 25], '00:01:00:00')], [('regression: field fill side', ['59.99', 24], '00:01:03:03'), ('regression variant: field fill side', ['59.23.99', 30], '00:59:26:09'), ('partial repair probe: field fill side', ['59:23', 24], '00:00:59:23'), ('partial repair variant: field fill side', ['23;1;1', 25], '00:23:01:01'), ('boundary control', ['1.2.3.4', 25], '01:02:03:04'), ('boundary control', ['99', 25], '00:00:03:24'), ('normal control', ['30', 24], '00:00:01:06'), ('normal control', ['1000', 24], '00:00:10:00'), ('normal control', ['2:23:61:99', 25], '02:24:04:24')], [('regression: field fill side', ['0:23:23', 24], '00:00:23:23'), ('regression variant: field fill side', ['59.2', 24], '00:00:59:02'), ('partial repair probe: field fill side', ['99.24.0', 24], '01:39:24:00'), ('partial repair variant: field fill side', ['10:30', 30], '00:00:11:00'), ('boundary control', ['23595924', 25], '23:59:59:24'), ('boundary control', ['1.2.3.4', 25], '01:02:03:04'), ('normal control', ['123456', 25], '00:12:36:06'), ('normal control', ['123456789', 25], None), ('normal control', ['x1', 24], None)], [('regression: field fill side', ['59:23', 24], '00:00:59:23'), ('regression variant: field fill side', ['1:30:10', 30], '00:01:30:10'), ('partial repair probe: field fill side', ['23:30:30', 24], '00:23:31:06'), ('partial repair variant: field fill side', ['23:59', 25], '00:00:25:09'), ('boundary control', ['100', 25], '00:00:01:00'), ('boundary control', ['23595924', 25], '23:59:59:24'), ('normal control', ['0:61:99:1:0', 30], None), ('normal control', ['59:23:23:10:10', 30], None), ('normal control', ['59.99.23.24', 24], '12:39:24:00')]]
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 fixtureActualExpectedOutcome
regression: field fill side00:00:01:0200:00:01:02Passed
regression variant: field fill side01:39:24:0001:39:24:00Passed
partial repair probe: field fill side00:01:03:0300:01:03:03Passed
partial repair variant: field fill side00:01:30:1000:01:30:10Passed
boundary control00:00:01:0000:00:01:00Passed
boundary control23:59:59:2423:59:59:24Passed
normal control00:00:03:2400:00:03:24Passed
normal control00:00:04:0300:00:04:03Passed
normal control00:00:01:0000:00:01:00Passed

SHA-256 / 63a450d184ec9e3836bf11e98d833692641d80d47120afbc9e5f5fb9ee148ed4

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

Case digest / 531eb3b188fa9d2b4cc4e74741fb3f17876169f9702ff8cee2e173e64a7f32af