X-Git-Url: http://git.ipfire.org/?p=location%2Flibloc.git;a=blobdiff_plain;f=src%2Fpython%2Flocation.in;h=0d09210d13fd25722252df77a3342cd98f1af385;hp=070640c2ae5cd5a07ce3875e76f444d9a2c6d719;hb=60c1ac0307312614bd6980d30b44bb59b5a6ab6e;hpb=0c74f6b1a3bdce5ebdc2ee452b9baf3e421dd3d1 diff --git a/src/python/location.in b/src/python/location.in index 070640c..0d09210 100644 --- a/src/python/location.in +++ b/src/python/location.in @@ -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