"""Arithmetic over original illustrative timestamps; no production telemetry."""
from datetime import datetime

def elapsed(a,b):
    return int((datetime.fromisoformat(b)-datetime.fromisoformat(a)).total_seconds())
histories={
 'A queue wait':{'accepted':'2025-09-11T09:00:00+00:00','enqueued':'2025-09-11T09:00:01+00:00','started':'2025-09-11T09:20:01+00:00','completed':'2025-09-11T09:20:02+00:00'},
 'B execution':{'accepted':'2025-09-11T09:00:00+00:00','enqueued':'2025-09-11T09:00:01+00:00','started':'2025-09-11T09:00:02+00:00','completed':'2025-09-11T09:20:02+00:00'},
}
for name,h in histories.items():
    h['queue_seconds']=elapsed(h['enqueued'],h['started'])
    h['execution_seconds']=elapsed(h['started'],h['completed'])
    h['total_seconds']=elapsed(h['accepted'],h['completed'])
    print(name,h)
assert histories['A queue wait']['queue_seconds']==1200
assert histories['A queue wait']['execution_seconds']==1
assert histories['B execution']['queue_seconds']==1
assert histories['B execution']['execution_seconds']==1200
assert {h['total_seconds'] for h in histories.values()}=={1202}
assert max(6,6)==6 and sum((6,6))==12
print('6/6 assertions passed. Parallel-span arithmetic is illustrative, not recorded latency.')
