From: Frank Brehm Date: Fri, 30 Jun 2017 15:30:19 +0000 (+0200) Subject: Generate all timestamps as naive datetime objects for UTC X-Git-Tag: 0.1.2~172^2~4 X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=490de07c65e143ddded402591f4dea3209e17637;p=pixelpark%2Fadmin-tools.git Generate all timestamps as naive datetime objects for UTC --- 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