location.in: do not confuse UTC with local time zones
authorPeter Müller <peter.mueller@ipfire.org>
Thu, 29 Oct 2020 14:36:46 +0000 (07:36 -0700)
committerPeter Müller <peter.mueller@ipfire.org>
Thu, 29 Oct 2020 14:36:46 +0000 (07:36 -0700)
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
src/python/location.in

index 070640c..0d09210 100644 (file)
@@ -398,10 +398,7 @@ class CLI(object):
 
        def handle_update(self, db, ns):
                if ns.cron and db:
-                       now = datetime.datetime.utcnow()
-
-                       # Parse the database timestamp
-                       t = datetime.datetime.utcfromtimestamp(db.created_at)
+                       now = time.time()
 
                        if ns.cron == "daily":
                                delta = datetime.timedelta(days=1)
@@ -410,11 +407,12 @@ class CLI(object):
                        elif ns.cron == "monthly":
                                delta = datetime.timedelta(days=30)
 
+                       delta = delta.total_seconds()
+
                        # Check if the database has recently been updated
-                       if t >= (now - delta):
+                       if db.created_at >= (now - delta):
                                log.info(
-                                       _("The database has been updated recently (%s)") % \
-                                               format_timedelta(now - t),
+                                       _("The database has been updated recently"),
                                )
                                return 3