# -*- coding: utf-8 -*-
"""只操作本程序创建的临时对象；全部数据为合成样本。"""
import os, sys, json, sqlite3, tempfile, pathlib, subprocess, time, socket, stat
from pathlib import Path
def emit(**kw):
    print(json.dumps(kw, ensure_ascii=False, sort_keys=True))
# 滑动窗口为定位辅助，不声称复刻systemd内部计数实现。
times=[0,1,2,3,20]; interval=10; burst=3; accepted=[]; history=[]
for t in times:
    history=[x for x in history if t-x<interval]
    allow=len(history)<burst
    if allow: history.append(t)
    accepted.append(allow)
reset_history=[]; after_reset=len(reset_history)<burst
assert accepted==[True,True,True,False,True] and after_reset
emit(times=times,allowed=accepted,after_reset=after_reset,scope='离线启动计划演算；未运行systemd manager，不是启动状态证据')
