From 490de07c65e143ddded402591f4dea3209e17637 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Fri, 30 Jun 2017 17:30:19 +0200 Subject: [PATCH] Generate all timestamps as naive datetime objects for UTC --- pp_lib/quota_check.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pp_lib/quota_check.py b/pp_lib/quota_check.py index 402ddd8..00a6ee9 100644 --- a/pp_lib/quota_check.py +++ b/pp_lib/quota_check.py @@ -114,7 +114,7 @@ class PpQuotaCheckApp(PpConfigApplication): self.passwd_data = {} self.map_uid = {} - self.now = datetime.datetime.now(UTC) + self.now = datetime.datetime.utcnow() self.du_cmd = self.get_command('du', quiet=True) self.do_statistics = False @@ -375,7 +375,7 @@ class PpQuotaCheckApp(PpConfigApplication): files.sort() # Removing all files older 4 years limit_age = time.time() - self.max_age - limit_age_dt = datetime.datetime.fromtimestamp(limit_age, UTC) + limit_age_dt = datetime.datetime.utcfromtimestamp(limit_age) LOG.info("Removing all status files older than {!r} ...".format( limit_age_dt.isoformat(' '))) @@ -559,7 +559,7 @@ class PpQuotaCheckApp(PpConfigApplication): util = self.get_util_dir_kb(path) total_kb += util result = { - 'checked': datetime.datetime.now(UTC), + 'checked': datetime.datetime.utcnow(), 'util_kb': util, 'uid': dir_uid, 'gid': dir_stat.st_gid, @@ -568,7 +568,7 @@ class PpQuotaCheckApp(PpConfigApplication): } check['data'][home_rel] = result - end_ts = datetime.datetime.now(UTC) + end_ts = datetime.datetime.utcnow() duration = end_ts - self.now dur_days = duration.days dur_secs = duration.seconds -- 2.39.5