[Git][NTPsec/ntpsec][master] 2 commits: gps-log: fox bad indent.

Gary E. Miller gitlab at mg.gitlab.com
Sat Dec 17 03:46:06 UTC 2016


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
717df68f by Gary E. Miller at 2016-12-16T19:40:29-08:00
gps-log: fox bad indent.

- - - - -
f09d6c4f by Gary E. Miller at 2016-12-16T19:41:49-08:00
gps-log/statfiles: try to stop reading/writing short log lines.

Too many buffers leads to fractional lines.

- - - - -


2 changed files:

- contrib/gps-log
- pylib/statfiles.py


Changes:

=====================================
contrib/gps-log
=====================================
--- a/contrib/gps-log
+++ b/contrib/gps-log
@@ -28,6 +28,7 @@ if __name__ == '__main__':
     try:
         gpsp.start() # start it up
         last_time = 0
+        print("")   # print blank line to prevent log corruption
         print("# Time       Device     TDOP     nSat")
         while True:
             #It may take a second or two to get good data
@@ -47,8 +48,8 @@ if __name__ == '__main__':
             except AttributeError as e:
                 print( 'parse error\n')
 
-        sys.stdout.flush()
-        time.sleep(5) #set to whatever
+            sys.stdout.flush()
+            time.sleep(5) #set to whatever
 
     except (KeyboardInterrupt, SystemExit): #when you press ctrl+c
         print("\nKilling Thread...")


=====================================
pylib/statfiles.py
=====================================
--- a/pylib/statfiles.py
+++ b/pylib/statfiles.py
@@ -101,6 +101,10 @@ class NTPStats:
                 # temps and gpsd are already in UNIX time
                 for line in lines:
                     split = line.split()
+                    if 3 > len(split):
+                        # skip short lines
+                        continue
+
                     try:
                         t = float(split[0])
                     except:



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/e92400db56b01eaf77b9862c12fcde35dcd63931...f09d6c4fee99948544b4a3cc1a256602d92612fc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20161217/dbbc6032/attachment.html>


More information about the vc mailing list