jiemianNews/defs/dump_data.py
2022-08-02 23:24:13 +08:00

17 lines
403 B
Python

import json
import time as time_
from os.path import exists
def get_time() -> int:
if exists("data.json"):
with open("data.json", "r") as f:
data = json.load(f)
return data.get("update_time", int(time_.time()) - 600)
return int(time_.time()) - 600
def set_time(time: int) -> None:
with open("data.json", "w") as f:
json.dump({"update_time": time}, f)