From 7272c745db156d4792c5d2f4df133966d3e8140e Mon Sep 17 00:00:00 2001 From: user202729 <25191436+user202729@users.noreply.github.com> Date: Mon, 9 Dec 2024 23:20:55 +0700 Subject: [PATCH] Fix incorrect datetime.UTC access --- src/scripts/cysignals-CSI | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/scripts/cysignals-CSI b/src/scripts/cysignals-CSI index ec39e86..021ca30 100755 --- a/src/scripts/cysignals-CSI +++ b/src/scripts/cysignals-CSI @@ -37,8 +37,8 @@ import tempfile import sysconfig import site +import datetime from argparse import ArgumentParser -from datetime import datetime from shutil import which import importlib.resources as importlib_resources @@ -130,8 +130,8 @@ def prune_old_logs(directory, days): """ for filename in os.listdir(directory): filename = os.path.join(directory, filename) - mtime = datetime.fromtimestamp(os.path.getmtime(filename), datetime.UTC) - age = datetime.now(datetime.UTC) - mtime + mtime = datetime.datetime.fromtimestamp(os.path.getmtime(filename), datetime.UTC) + age = datetime.datetime.now(datetime.UTC) - mtime if age.days >= days: try: os.unlink(filename)