Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dealing with "Satellite Time" #3

Open
johnnyman727 opened this issue May 25, 2014 · 8 comments
Open

Dealing with "Satellite Time" #3

johnnyman727 opened this issue May 25, 2014 · 8 comments

Comments

@johnnyman727
Copy link
Contributor

We currently send back a date and time like the following:

Current GPS date and time:
  Year:      2014
  Month:     05
  Day:       25
  Timestamp:     21:01:36.000

That timestamp says that it's 9:01pm when it's actually 2:01 pm.

Is that time parsed wrong? If not, can we get the timezone information? It would be ideal if the time was a Date object

@ekolker
Copy link
Member

ekolker commented May 26, 2014

TL;DR: In essence, the whole GPS system works because all the satellites are synced to the same clock, and GPS time doesn't (and shouldn't) care about time zones: http://leapsecond.com/java/gpsclock.htm.

I guess we/the user could take the coordinates and back-calculate the local time based on the timezone (and date), but that code would likely be some combination of large, messy, and/or reliant on a network connection.

Also: we're using this module for all our NMEA parsing. It's being parsed correctly.

We get time information as soon we we get a strong signal from a single satellite, so we don't necessarily know where we are when we know what (GPS) time it is.

@tcr
Copy link
Member

tcr commented May 26, 2014

Ever logged into a message board? They usually ask you to set a timezone. We can explicitly pass your current TZ information along with the build and just use that unless your datetime is changed.

With that said, any dates we generate from GPS will be timezone-unaware anyway. They're just UTC dates, it's up to the user to calibrate them. I have no qualms with loading info from new Date().getTimezoneOffset() or just explicitly making the user enter that info.

@mattsoftware
Copy link
Contributor

How do I get the date/time format from the module? At the moment I am only getting timestamp in the form hhmmss.xxx. I would like to get the date out of it as well but so far have been unable to work out how to get it!.

@jiahuang
Copy link
Contributor

@mattsoftware,

So most of the GPS processing is actually done in firmware. It's been a while since I did the parsing, but IIRC I only parsed 2 GPS message types: GPRMC and GPGGA. These gps functions are called from lua here and here.

Then the GPS js code is able to call the functions by binding to the hw lib, like in here.

It looks like you want the GPZDA parsed as well. In order to do that you'll have to modify the gps-nema shim and add in some additional parsing here.

Then probably add in an additional "get date" function that can be exposed from within JS.

@mattsoftware
Copy link
Contributor

Looks like the get date function is already there, but simply calls the get timestamp. I wanted to avoid firmware development, but I think I'll jump in and have a look at this. Thanks for your thorough reply.

@jiahuang
Copy link
Contributor

It's getting parsed from the GPGGA data which doesn't have the full date, only the timestamp.

@srl295
Copy link
Contributor

srl295 commented Jul 7, 2015

@jiahuang https://github.com/tessel/t1-firmware/blob/master/src/module_shims/gps-nmea.c#L163 could parse $GPZDA to get the date. But the code seems to parse $GPRMC field 9 which should be a "UT date". (except for the bug in gps_get_date() I referenced above)

@srl295
Copy link
Contributor

srl295 commented Jul 9, 2015

@jiahuang with the bug above fixed, gps_get_date() does seem to return the full date, so $GPRMC is coming in. Probably here you could add datestamp: hw.gps_get_date()

srl295 added a commit to srl295/gps-a2235h that referenced this issue Aug 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants