|
@@ -70,7 +70,12 @@ def main():
|
|
else:
|
|
else:
|
|
# 状态未变化,打印当前状态
|
|
# 状态未变化,打印当前状态
|
|
status_text = "在线" if is_service_online else "离线"
|
|
status_text = "在线" if is_service_online else "离线"
|
|
- print(f"服务状态: {status_text}")
|
|
|
|
|
|
+ # 获取当前时间的时间元组
|
|
|
|
+ current_time = time.localtime()
|
|
|
|
+
|
|
|
|
+ # 格式化输出年月日时分秒
|
|
|
|
+ formatted_time = time.strftime("%Y年%m月%d日 %H:%M:%S", current_time)
|
|
|
|
+ print(f"{formatted_time} 服务状态: {status_text}")
|
|
|
|
|
|
# 等待下次检查
|
|
# 等待下次检查
|
|
time.sleep(CHECK_INTERVAL)
|
|
time.sleep(CHECK_INTERVAL)
|