diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2022-10-31 20:56:23 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2022-10-31 20:56:23 +0100 |
commit | 8fd1aa2422a55e187f1c1c82c68daaf833d63865 (patch) | |
tree | c75870b8c8875272053c0ff77b493329b4026f6d /glutte_serial_web.py | |
parent | f5932782310806150aa3dceeadacaeae448ca702 (diff) | |
download | glutte-serial-web-8fd1aa2422a55e187f1c1c82c68daaf833d63865.tar.gz glutte-serial-web-8fd1aa2422a55e187f1c1c82c68daaf833d63865.tar.bz2 glutte-serial-web-8fd1aa2422a55e187f1c1c82c68daaf833d63865.zip |
Replace unix timestamps by datetime in cache
Diffstat (limited to 'glutte_serial_web.py')
-rwxr-xr-x | glutte_serial_web.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/glutte_serial_web.py b/glutte_serial_web.py index da61b1b..2c53094 100755 --- a/glutte_serial_web.py +++ b/glutte_serial_web.py @@ -26,7 +26,6 @@ import time import json from geventwebsocket.handler import WebSocketHandler from gevent import pywsgi, Timeout -from time import sleep from flask import Flask, Response, render_template, jsonify from flask_sockets import Sockets import serialrx @@ -49,7 +48,7 @@ def history(): if config.CACHE_FILE: with open(config.CACHE_FILE) as fd: hist = json.load(fd) - text = "\n".join(f"{entry['ts']} {entry['line']}" for entry in hist) + text = "\n".join(f"{entry['ts'].isoformat()} {entry['line']}" for entry in hist) return Response(text, mimetype='text/plain') @app.route('/stats') @@ -88,7 +87,7 @@ def stream(socket): pass except: error = True - sleep(0.1) + time.sleep(0.1) except: raise finally: |