From d51f014fbfd823313fcb87113830697abf116dd3 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 13 Mar 2022 08:46:20 -0400 Subject: [PATCH] time from json --- groundstation/tago-upload.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/groundstation/tago-upload.py b/groundstation/tago-upload.py index e6d17f75..6b1706b1 100644 --- a/groundstation/tago-upload.py +++ b/groundstation/tago-upload.py @@ -1,6 +1,7 @@ import tago import requests import json +from datetime import datetime while (True): @@ -13,7 +14,8 @@ while (True): lat = telem_json['entries'][0]['lat'] lon = telem_json['entries'][0]['lng'] telem_string = telem_json['entries'][0]['comment'] - + time = int(telem_json['timestamp']) + print(lat) print(lon) print(telem_string) @@ -29,8 +31,8 @@ while (True): altitude = 0 humidity = 0 - time = chunks[0] + " " + chunks[1] - timestamp = datetime.utcfromtimestamp(time).strftime('%Y-%m-%d %H:%M:%S') + + timestamp = datetime.fromtimestamp(time).strftime('%Y-%m-%d %H:%M:%S') print(timestamp) for i in range(len(chunks)):