Split the int timestamp from frac timestamp so you don't lose precision when using, say, UTC time. Cleaned up some cruft while I was at it. This also allows devices which don't have timestamps to tag based on samples elapsed since the flowgraph started.
This commit is contained in:
@@ -28,7 +28,8 @@ class output_flightgear(air_modes.parse):
|
||||
self.sock.connect((self.hostname, self.port))
|
||||
|
||||
def output(self, message):
|
||||
[data, ecc, reference, timestamp] = message.split()
|
||||
[data, ecc, reference, timestamp_int, timestamp_frac] = message.split()
|
||||
timestamp = int(timestamp_int) + float(timestamp_frac)
|
||||
data = air_modes.modes_reply(long(data, 16))
|
||||
|
||||
try:
|
||||
|
||||
@@ -30,11 +30,11 @@ class output_print(air_modes.parse):
|
||||
air_modes.parse.__init__(self, mypos)
|
||||
|
||||
def parse(self, message):
|
||||
[data, ecc, reference, timestamp] = message.split()
|
||||
[data, ecc, reference, timestamp_int, timestamp_frac] = message.split()
|
||||
timestamp = int(timestamp_int) + float(timestamp_frac)
|
||||
|
||||
ecc = long(ecc, 16)
|
||||
reference = float(reference)
|
||||
timestamp = float(timestamp)
|
||||
|
||||
if reference == 0.0:
|
||||
refdb = -150.0
|
||||
|
||||
@@ -103,7 +103,8 @@ class output_sbs1(air_modes.parse):
|
||||
def parse(self, message):
|
||||
#assembles a SBS-1-style output string from the received message
|
||||
|
||||
[data, ecc, reference, timestamp] = message.split()
|
||||
[data, ecc, reference, timestamp_int, timestamp_frac] = message.split()
|
||||
timestamp = int(timestamp_int) + float(timestamp_frac)
|
||||
|
||||
data = air_modes.modes_reply(long(data, 16))
|
||||
ecc = long(ecc, 16)
|
||||
|
||||
@@ -89,7 +89,8 @@ class output_sql(air_modes.parse):
|
||||
def make_insert_query(self, message):
|
||||
#assembles a SQL query tailored to our database
|
||||
#this version ignores anything that isn't Type 17 for now, because we just don't care
|
||||
[data, ecc, reference, timestamp] = message.split()
|
||||
[data, ecc, reference, timestamp_int, timestamp_frac] = message.split()
|
||||
timestamp = int(timestamp_int) + float(timestamp_frac)
|
||||
|
||||
data = air_modes.modes_reply(long(data, 16))
|
||||
ecc = long(ecc, 16)
|
||||
|
||||
Reference in New Issue
Block a user