import sqlite3,json,datetime,math
from pathlib import Path
root=Path(__file__).parent
out={}
for side in ['before','after']:
 c=sqlite3.connect(f'file:/home/user/wt/issue-33740-{side}/.t3/userdata/statev2.sqlite?mode=ro',uri=True)
 created,updated=c.execute('select created_at,updated_at from orchestration_v2_projection_threads').fetchone()
 stamp=datetime.datetime.fromisoformat(updated.replace('Z','+00:00')).timestamp()*1000
 frozen=math.ceil(stamp/60000)*60000+4*3600000
 out[side]={'createdAt':created,'updatedAt':updated,'freezeMs':frozen,'freezeISO':datetime.datetime.fromtimestamp(frozen/1000,datetime.timezone.utc).isoformat(),'formula':'ceil(Date.parse(updatedAt)/60000)*60000 + 4*3600000','label':'4h'}
(root/'seed-clock.json').write_text(json.dumps(out,indent=2))
print('Wrote seed-clock.json from isolated synthetic threads (read-only database access).')
