summaryrefslogtreecommitdiff
path: root/gps.py
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2005-03-24 22:41:30 +0000
committerEric S. Raymond <esr@thyrsus.com>2005-03-24 22:41:30 +0000
commit57cbdf1a9dadd6c628afb525828ab33ad66f2668 (patch)
tree8bb54bc81d00abaa1b13ef40067f0d254d0eb77d /gps.py
parentf6d5df299afb98ce5ecb5488992e2d44968786cb (diff)
downloadgpsd-57cbdf1a9dadd6c628afb525828ab33ad66f2668.tar.gz
Raw-mode profiling now works on SiRF. Only split mode is still broken.
Diffstat (limited to 'gps.py')
-rwxr-xr-xgps.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/gps.py b/gps.py
index 450a7092..973256a4 100755
--- a/gps.py
+++ b/gps.py
@@ -59,7 +59,6 @@ class gpsdata:
self.online = 0 # NZ if GPS on, zero if not
self.mode = MODE_NO_FIX
- self.fixtime = 0.0
self.latitude = self.longitude = 0.0
self.eph = 0.0
self.altitude = ALTITUDE_NOT_VALID # Meters
@@ -85,6 +84,7 @@ class gpsdata:
self.profiling = False
self.tag = ""
self.length = 0
+ self.gps_time = 0.0
self.d_recv_time = 0
self.d_decode_time = 0
self.emit_time = 0
@@ -174,7 +174,7 @@ class gps(gpsdata):
def __unpack(self, buf):
# unpack a daemon response into the instance members
- self.utc = "?"
+ self.gps_time = 0.0
fields = buf.strip().split(",")
if fields[0] == "GPSD":
for field in fields[1:]:
@@ -195,6 +195,7 @@ class gps(gpsdata):
self.cycle = int(data)
elif cmd in ('D', 'd'):
self.utc = data
+ self.gps_time = isotime(self.utc)
self.valid |= TIME_SET
elif cmd in ('E', 'e'):
parts = data.split()
@@ -212,7 +213,7 @@ class gps(gpsdata):
if fields[0] == '?':
self.mode = MODE_NO_FIX
else:
- self.time = float(fields[0])
+ self.gps_time = float(fields[0])
self.ept = float(fields[1])
self.latitude = float(fields[2])
self.longitude = float(fields[3])
@@ -299,14 +300,12 @@ class gps(gpsdata):
return -1
if self.verbose:
sys.stderr.write("GPS DATA %s\n" % repr(data))
- if self.profiling:
- self.c_recv_time = time.time()
+ self.c_recv_time = time.time()
self.__unpack(data)
- if self.utc != "?":
- if self.profiling:
- self.c_decode_time = time.time()
- self.c_recv_time -= self.gps_time
- self.c_decode_time -= self.gps_time
+ if self.gps_time:
+ self.c_decode_time = time.time()
+ self.c_recv_time -= self.gps_time
+ self.c_decode_time -= self.gps_time
return 0
def query(self, commands):