]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
location(8): Fix pasing timestamp for systems not running on UTC
authorStefan Schantl <stefan.schantl@ipfire.org>
Fri, 10 Jul 2020 14:40:33 +0000 (16:40 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Fri, 10 Jul 2020 14:40:33 +0000 (16:40 +0200)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
src/python/location.in

index 5189738c449cb082e0d3cef6b88d57e4818335b7..5211b2837116174c52235b8a1ef681ba146f439a 100644 (file)
@@ -401,7 +401,7 @@ class CLI(object):
                        now = datetime.datetime.utcnow()
 
                        # Parse the database timestamp
-                       t = datetime.datetime.fromtimestamp(db.created_at)
+                       t = datetime.datetime.utcfromtimestamp(db.created_at)
 
                        if ns.cron == "daily":
                                delta = datetime.timedelta(days=1)
@@ -422,7 +422,7 @@ class CLI(object):
                t = location.discover_latest_version()
 
                # Parse timestamp into datetime format
-               timestamp = datetime.datetime.fromtimestamp(t) if t else None
+               timestamp = datetime.datetime.utcfromtimestamp(t) if t else None
 
                # Check the version of the local database
                if db and timestamp and db.created_at >= timestamp.timestamp():