FAILURE MAP
← Case archive

FA-78796 / Broadcast timecode arithmetic / Open access

Chase-lock offset with subframes: magnitude split · case 01

A lag of 1.5 frames is reported as -2 frames and +50 subframes.

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

ROOT CAUSE

Negative offsets are split with floor division before applying the sign.

VERIFIED REPAIR

Split the magnitude, then apply the sign to both parts.

Unsuccessful approach: Taking the subframe remainder of the signed value still gives the floor-complement.

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//2:
        d-=day
    sign=-1 if d<0 else 1
    q,r=divmod(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: magnitude split', ['00:00:00:01.50', '00:00:00:00.00', 25], [-1, -50]), ('regression variant: magnitude split', ['01:30:00:00.5', '01:00:59:00.05', 30], [-52230, -45]), ('partial repair probe: magnitude split', ['12:59:30:01.50', '00:59:59:00.05', 30], [-1295131, -45]), ('partial repair variant: magnitude split', ['23:59:30:00.0', '23:00:00:29.05', 30], [-107070, -95]), ('boundary control', ['00:00:00:00.00', '00:00:00:01.50', 25], [1, 50]), ('boundary control', ['00:00:00:00.0', '12:00:00:00.0', 25], [1080000, 0]), ('normal 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', ['00:30:59:00.0', '12:30:59:00.0', 30], [1296000, 0])], [('regression: magnitude split', ['01:00:59:29.50', '00:30:30:29.99', 30], [-54869, -51]), ('regression variant: magnitude split', ['00:00:00:01.05', '23:00:00:01.05', 25], [-90000, 0]), ('partial repair probe: magnitude split', ['01:30:00:00.5', '01:00:59:00.05', 30], [-52230, -45]), ('partial repair variant: magnitude split', ['00:00:00:01.05', '12:00:59:24.5', 25], [-1078501, -55]), ('boundary control', ['00:00:00:00.0', '12:00:00:00.0', 25], [1080000, 0]), ('boundary control', ['23:59:59:24.5', '00:00:00:00.0', 25], [0, 50]), ('normal control', ['01:30:59:29.05', '13:30:59:29.05', 30], [1296000, 0]), ('normal control', ['23:59:00:24.5', '00:30:59:01.0', 25], [47951, 50]), ('normal control', ['23:30:59:00.5', '23:59:30:01.00', 30], [51330, 50])], [('regression: magnitude split', ['01:00:30:00.99', '23:30:00:29.50', 30], [-162871, -49]), ('regression variant: magnitude split', ['00:59:00:29.00', '00:00:00:01.05', 30], [-106227, -95]), ('partial repair probe: magnitude split', ['12:00:59:01.50', '01:00:00:01.05', 25], [-991475, -45]), ('partial repair variant: magnitude split', ['01:59:30:00.99', '23:00:59:00.00', 30], [-321330, -99]), ('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', ['12:59:59:01.05', '00:00:59:24.00', 25], [991522, 95]), ('normal control', ['23:59:59:29.05', '00:59:00:01.00', 30], [106201, 95]), ('normal control', ['23:00:00:00.05', '23:30:00:01.0', 30], [54000, 95])], [('regression: magnitude split', ['01:59:30:29.50', '01:30:30:29.0', 30], [-52200, -50]), ('regression variant: magnitude split', ['00:59:30:01.5', '23:00:00:29.50', 30], [-215072, 0]), ('partial repair probe: magnitude split', ['12:00:59:01.50', '01:00:00:01.05', 25], [-991475, -45]), ('partial repair variant: magnitude split', ['12:59:59:00.5', '01:59:00:00.99', 30], [-1189769, -51]), ('boundary control', ['00:00:00:00.00', '00:00:00:01.50', 25], [1, 50]), ('boundary control', ['00:00:00:00.0', '12:00:00:00.0', 25], [1080000, 0]), ('normal control', ['01:00:00:00.00', '01:59:00:01.50', 30], [106201, 50]), ('normal control', ['00:59:00:01.50', '12:30:59:00.00', 25], [1037973, 50]), ('normal control', ['00:59:59:01.05', '12:59:59:01.05', 30], [1296000, 0])], [('regression: magnitude split', ['12:59:30:01.50', '00:59:59:00.05', 30], [-1295131, -45]), ('regression variant: magnitude split', ['12:00:59:01.50', '01:00:00:01.05', 25], [-991475, -45]), ('partial repair probe: magnitude split', ['01:30:00:00.0', '01:00:59:24.99', 25], [-43500, -1]), ('partial repair variant: magnitude split', ['12:59:59:24.99', '12:59:00:24.05', 25], [-1475, -94]), ('boundary control', ['00:00:00:00.0', '12:00:00:00.0', 25], [1080000, 0]), ('boundary control', ['23:59:59:24.5', '00:00:00:00.0', 25], [0, 50]), ('normal control', ['23:00:59:01.5', '01:30:00:00.0', 30], [268228, 50]), ('normal control', ['01:59:30:29.05', '13:59:30:29.05', 30], [1296000, 0]), ('normal control', ['23:30:30:01.99', '23:59:59:01.05', 25], [44224, 6])]]
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: magnitude split[2, -50][-1, -50]Failed
regression variant: magnitude split[52231, -55][-52230, -45]Failed
partial repair probe: magnitude split[1295132, -55][-1295131, -45]Failed
partial repair variant: magnitude split[107071, -5][-107070, -95]Failed
boundary control[1, 50][1, 50]Passed
boundary control[1080000, 0][1080000, 0]Passed
normal control[0, 50][0, 50]Passed
normal control[106259, 0][106259, 0]Passed
normal control[1296000, 0][1296000, 0]Passed

SHA-256 / 014e9aeb9833858ad5de6991c76ac4b9c5fbaffa9cecac9e519f48e0a10b4ce4

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=(abs(d)//100,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: magnitude split', ['00:00:00:01.50', '00:00:00:00.00', 25], [-1, -50]), ('regression variant: magnitude split', ['01:30:00:00.5', '01:00:59:00.05', 30], [-52230, -45]), ('partial repair probe: magnitude split', ['12:59:30:01.50', '00:59:59:00.05', 30], [-1295131, -45]), ('partial repair variant: magnitude split', ['23:59:30:00.0', '23:00:00:29.05', 30], [-107070, -95]), ('boundary control', ['00:00:00:00.00', '00:00:00:01.50', 25], [1, 50]), ('boundary control', ['00:00:00:00.0', '12:00:00:00.0', 25], [1080000, 0]), ('normal 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', ['00:30:59:00.0', '12:30:59:00.0', 30], [1296000, 0])], [('regression: magnitude split', ['01:00:59:29.50', '00:30:30:29.99', 30], [-54869, -51]), ('regression variant: magnitude split', ['00:00:00:01.05', '23:00:00:01.05', 25], [-90000, 0]), ('partial repair probe: magnitude split', ['01:30:00:00.5', '01:00:59:00.05', 30], [-52230, -45]), ('partial repair variant: magnitude split', ['00:00:00:01.05', '12:00:59:24.5', 25], [-1078501, -55]), ('boundary control', ['00:00:00:00.0', '12:00:00:00.0', 25], [1080000, 0]), ('boundary control', ['23:59:59:24.5', '00:00:00:00.0', 25], [0, 50]), ('normal control', ['01:30:59:29.05', '13:30:59:29.05', 30], [1296000, 0]), ('normal control', ['23:59:00:24.5', '00:30:59:01.0', 25], [47951, 50]), ('normal control', ['23:30:59:00.5', '23:59:30:01.00', 30], [51330, 50])], [('regression: magnitude split', ['01:00:30:00.99', '23:30:00:29.50', 30], [-162871, -49]), ('regression variant: magnitude split', ['00:59:00:29.00', '00:00:00:01.05', 30], [-106227, -95]), ('partial repair probe: magnitude split', ['12:00:59:01.50', '01:00:00:01.05', 25], [-991475, -45]), ('partial repair variant: magnitude split', ['01:59:30:00.99', '23:00:59:00.00', 30], [-321330, -99]), ('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', ['12:59:59:01.05', '00:00:59:24.00', 25], [991522, 95]), ('normal control', ['23:59:59:29.05', '00:59:00:01.00', 30], [106201, 95]), ('normal control', ['23:00:00:00.05', '23:30:00:01.0', 30], [54000, 95])], [('regression: magnitude split', ['01:59:30:29.50', '01:30:30:29.0', 30], [-52200, -50]), ('regression variant: magnitude split', ['00:59:30:01.5', '23:00:00:29.50', 30], [-215072, 0]), ('partial repair probe: magnitude split', ['12:00:59:01.50', '01:00:00:01.05', 25], [-991475, -45]), ('partial repair variant: magnitude split', ['12:59:59:00.5', '01:59:00:00.99', 30], [-1189769, -51]), ('boundary control', ['00:00:00:00.00', '00:00:00:01.50', 25], [1, 50]), ('boundary control', ['00:00:00:00.0', '12:00:00:00.0', 25], [1080000, 0]), ('normal control', ['01:00:00:00.00', '01:59:00:01.50', 30], [106201, 50]), ('normal control', ['00:59:00:01.50', '12:30:59:00.00', 25], [1037973, 50]), ('normal control', ['00:59:59:01.05', '12:59:59:01.05', 30], [1296000, 0])], [('regression: magnitude split', ['12:59:30:01.50', '00:59:59:00.05', 30], [-1295131, -45]), ('regression variant: magnitude split', ['12:00:59:01.50', '01:00:00:01.05', 25], [-991475, -45]), ('partial repair probe: magnitude split', ['01:30:00:00.0', '01:00:59:24.99', 25], [-43500, -1]), ('partial repair variant: magnitude split', ['12:59:59:24.99', '12:59:00:24.05', 25], [-1475, -94]), ('boundary control', ['00:00:00:00.0', '12:00:00:00.0', 25], [1080000, 0]), ('boundary control', ['23:59:59:24.5', '00:00:00:00.0', 25], [0, 50]), ('normal control', ['23:00:59:01.5', '01:30:00:00.0', 30], [268228, 50]), ('normal control', ['01:59:30:29.05', '13:59:30:29.05', 30], [1296000, 0]), ('normal control', ['23:30:30:01.99', '23:59:59:01.05', 25], [44224, 6])]]
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: magnitude split[-1, -50][-1, -50]Passed
regression variant: magnitude split[-52230, -55][-52230, -45]Failed
partial repair probe: magnitude split[-1295131, -55][-1295131, -45]Failed
partial repair variant: magnitude split[-107070, -5][-107070, -95]Failed
boundary control[1, 50][1, 50]Passed
boundary control[1080000, 0][1080000, 0]Passed
normal control[0, 50][0, 50]Passed
normal control[106259, 0][106259, 0]Passed
normal control[1296000, 0][1296000, 0]Passed

SHA-256 / 23b045f4f7ecc134697bc19bfa9e69bbcfd5cd2f70775ff3b5452c761a6e7d71

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: magnitude split', ['00:00:00:01.50', '00:00:00:00.00', 25], [-1, -50]), ('regression variant: magnitude split', ['01:30:00:00.5', '01:00:59:00.05', 30], [-52230, -45]), ('partial repair probe: magnitude split', ['12:59:30:01.50', '00:59:59:00.05', 30], [-1295131, -45]), ('partial repair variant: magnitude split', ['23:59:30:00.0', '23:00:00:29.05', 30], [-107070, -95]), ('boundary control', ['00:00:00:00.00', '00:00:00:01.50', 25], [1, 50]), ('boundary control', ['00:00:00:00.0', '12:00:00:00.0', 25], [1080000, 0]), ('normal 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', ['00:30:59:00.0', '12:30:59:00.0', 30], [1296000, 0])], [('regression: magnitude split', ['01:00:59:29.50', '00:30:30:29.99', 30], [-54869, -51]), ('regression variant: magnitude split', ['00:00:00:01.05', '23:00:00:01.05', 25], [-90000, 0]), ('partial repair probe: magnitude split', ['01:30:00:00.5', '01:00:59:00.05', 30], [-52230, -45]), ('partial repair variant: magnitude split', ['00:00:00:01.05', '12:00:59:24.5', 25], [-1078501, -55]), ('boundary control', ['00:00:00:00.0', '12:00:00:00.0', 25], [1080000, 0]), ('boundary control', ['23:59:59:24.5', '00:00:00:00.0', 25], [0, 50]), ('normal control', ['01:30:59:29.05', '13:30:59:29.05', 30], [1296000, 0]), ('normal control', ['23:59:00:24.5', '00:30:59:01.0', 25], [47951, 50]), ('normal control', ['23:30:59:00.5', '23:59:30:01.00', 30], [51330, 50])], [('regression: magnitude split', ['01:00:30:00.99', '23:30:00:29.50', 30], [-162871, -49]), ('regression variant: magnitude split', ['00:59:00:29.00', '00:00:00:01.05', 30], [-106227, -95]), ('partial repair probe: magnitude split', ['12:00:59:01.50', '01:00:00:01.05', 25], [-991475, -45]), ('partial repair variant: magnitude split', ['01:59:30:00.99', '23:00:59:00.00', 30], [-321330, -99]), ('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', ['12:59:59:01.05', '00:00:59:24.00', 25], [991522, 95]), ('normal control', ['23:59:59:29.05', '00:59:00:01.00', 30], [106201, 95]), ('normal control', ['23:00:00:00.05', '23:30:00:01.0', 30], [54000, 95])], [('regression: magnitude split', ['01:59:30:29.50', '01:30:30:29.0', 30], [-52200, -50]), ('regression variant: magnitude split', ['00:59:30:01.5', '23:00:00:29.50', 30], [-215072, 0]), ('partial repair probe: magnitude split', ['12:00:59:01.50', '01:00:00:01.05', 25], [-991475, -45]), ('partial repair variant: magnitude split', ['12:59:59:00.5', '01:59:00:00.99', 30], [-1189769, -51]), ('boundary control', ['00:00:00:00.00', '00:00:00:01.50', 25], [1, 50]), ('boundary control', ['00:00:00:00.0', '12:00:00:00.0', 25], [1080000, 0]), ('normal control', ['01:00:00:00.00', '01:59:00:01.50', 30], [106201, 50]), ('normal control', ['00:59:00:01.50', '12:30:59:00.00', 25], [1037973, 50]), ('normal control', ['00:59:59:01.05', '12:59:59:01.05', 30], [1296000, 0])], [('regression: magnitude split', ['12:59:30:01.50', '00:59:59:00.05', 30], [-1295131, -45]), ('regression variant: magnitude split', ['12:00:59:01.50', '01:00:00:01.05', 25], [-991475, -45]), ('partial repair probe: magnitude split', ['01:30:00:00.0', '01:00:59:24.99', 25], [-43500, -1]), ('partial repair variant: magnitude split', ['12:59:59:24.99', '12:59:00:24.05', 25], [-1475, -94]), ('boundary control', ['00:00:00:00.0', '12:00:00:00.0', 25], [1080000, 0]), ('boundary control', ['23:59:59:24.5', '00:00:00:00.0', 25], [0, 50]), ('normal control', ['23:00:59:01.5', '01:30:00:00.0', 30], [268228, 50]), ('normal control', ['01:59:30:29.05', '13:59:30:29.05', 30], [1296000, 0]), ('normal control', ['23:30:30:01.99', '23:59:59:01.05', 25], [44224, 6])]]
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: magnitude split[-1, -50][-1, -50]Passed
regression variant: magnitude split[-52230, -45][-52230, -45]Passed
partial repair probe: magnitude split[-1295131, -45][-1295131, -45]Passed
partial repair variant: magnitude split[-107070, -95][-107070, -95]Passed
boundary control[1, 50][1, 50]Passed
boundary control[1080000, 0][1080000, 0]Passed
normal control[0, 50][0, 50]Passed
normal control[106259, 0][106259, 0]Passed
normal control[1296000, 0][1296000, 0]Passed

SHA-256 / 143f9e93f593a349812daeac73df64305eaa9c4f0bb1a5b5f1ac53af24dd5408

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

Case digest / 77843d6fc07724a7a905d017ea57943e89fa7e78f9c5a6ba9966f9bd830a4310