From 6edabcaabe80d0e7ace28bf71fcab85f873bbc2f Mon Sep 17 00:00:00 2001 From: Mark Jessop Date: Mon, 24 Apr 2017 09:53:34 +0930 Subject: [PATCH] Fixes to system time setting. --- tx/tx_picam_gps.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tx/tx_picam_gps.py b/tx/tx_picam_gps.py index 7046aea..5294881 100644 --- a/tx/tx_picam_gps.py +++ b/tx/tx_picam_gps.py @@ -57,8 +57,9 @@ def handle_gps_data(gps_data): if (gps_data['gpsFix'] == 3) and not system_time_set: dt = gps_data['datetime'] try: - subprocess.call(['date', '-s', '{:}'.format(dt.strftime('%Y/%m/%d %H:%M:%S'))], shell=True) - tx.transmit_text_message("GPS Debug: System clock set to GPS time %s" % gps_data['timestamp']) + new_time = dt.strftime('%Y/%m/%d %H:%M:%S') + subprocess.call(['date', '-s', '\"{:}\"'.format(new_time)], shell=True) + tx.transmit_text_message("GPS Debug: System clock set to GPS time %s" % new_time) system_time_set = True except: tx.transmit_text_message("GPS Debug: Attempt to set system clock failed!")