{"action":"created","issue":{"url":"https://api.github.com/repos/cyoung/stratux/issues/177","labels_url":"https://api.github.com/repos/cyoung/stratux/issues/177/labels{/name}","comments_url":"https://api.github.com/repos/cyoung/stratux/issues/177/comments","events_url":"https://api.github.com/repos/cyoung/stratux/issues/177/events","html_url":"https://github.com/cyoung/stratux/issues/177","id":124510626,"number":177,"title":"RPi datetime being set to bad GPS value","user":{"login":"bradanlane","id":14001599,"avatar_url":"https://avatars.githubusercontent.com/u/14001599?v=3","gravatar_id":"","url":"https://api.github.com/users/bradanlane","html_url":"https://github.com/bradanlane","followers_url":"https://api.github.com/users/bradanlane/followers","following_url":"https://api.github.com/users/bradanlane/following{/other_user}","gists_url":"https://api.github.com/users/bradanlane/gists{/gist_id}","starred_url":"https://api.github.com/users/bradanlane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradanlane/subscriptions","organizations_url":"https://api.github.com/users/bradanlane/orgs","repos_url":"https://api.github.com/users/bradanlane/repos","events_url":"https://api.github.com/users/bradanlane/events{/privacy}","received_events_url":"https://api.github.com/users/bradanlane/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-12-31T22:27:58Z","updated_at":"2016-01-01T03:08:43Z","closed_at":null,"body":"It looks like the GPS code is trying to set the RPi clock even before it has a good datetime. In my output I see if go from \"now\" back to 1980 *(no DeLorean needed)*.\r\n\r\n```\r\n2015/12/31 22:21:55 stats [up since: 3 minutes ago]\r\n2015/12/31 22:21:55  - CPUTemp=57.00 deg C, MemStats.Alloc=8.9 MB, MemStats.Sys=13 MB, totalNetworkMessagesSent=0\r\n2015/12/31 22:21:55  - UAT/min 0/0 [maxSS=0.00%], ES/min 0/0\r\n, Total traffic targets tracked=0\r\n2015/12/31 22:21:55  - Last GPS fix: a long while ago, GPS solution type: 0 using 0 satellites (0/0 seen/tracked), NACp: 0, est accuracy 0.00 m\r\n2015/12/31 22:21:55  - GPS vertical velocity: 0.00 ft/sec; GPS vertical accuracy: 0 m\r\n2015/12/31 22:22:01 setting system time to: 1980-01-06 00:10:10 +0000 UTC\r\n1980/01/06 00:10:34 stats [up since: 36 years from now]\r\n1980/01/06 00:10:34  - CPUTemp=53.00 deg C, MemStats.Alloc=4.7 MB, MemStats.Sys=13 MB, totalNetworkMessagesSent=0\r\n1980/01/06 00:10:34  - UAT/min 0/0 [maxSS=0.00%], ES/min 0/0\r\n, Total traffic targets tracked=0\r\n1980/01/06 00:10:34  - Last GPS fix: a long while ago, GPS solution type: 0 using 0 satellites (0/0 seen/tracked), NACp: 0, est accuracy 0.00 m\r\n```"},"comment":{"url":"https://api.github.com/repos/cyoung/stratux/issues/comments/168279216","html_url":"https://github.com/cyoung/stratux/issues/177#issuecomment-168279216","issue_url":"https://api.github.com/repos/cyoung/stratux/issues/177","id":168279216,"user":{"login":"skypuppy","id":13644705,"avatar_url":"https://avatars.githubusercontent.com/u/13644705?v=3","gravatar_id":"","url":"https://api.github.com/users/skypuppy","html_url":"https://github.com/skypuppy","followers_url":"https://api.github.com/users/skypuppy/followers","following_url":"https://api.github.com/users/skypuppy/following{/other_user}","gists_url":"https://api.github.com/users/skypuppy/gists{/gist_id}","starred_url":"https://api.github.com/users/skypuppy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skypuppy/subscriptions","organizations_url":"https://api.github.com/users/skypuppy/orgs","repos_url":"https://api.github.com/users/skypuppy/repos","events_url":"https://api.github.com/users/skypuppy/events{/privacy}","received_events_url":"https://api.github.com/users/skypuppy/received_events","type":"User","site_admin":false},"created_at":"2016-01-01T03:08:42Z","updated_at":"2016-01-01T03:08:42Z","body":"There is \"gps fix\" data on one of the NMEA lines.  You could just\ncontinue to sample that line until the fix becomes good at at least a\n2D.  Then the gps clock should be fine and you could use it.  Save a ton\nof coding for ya.\n\n\n\nOn 12/31/2015 06:29 PM, AvSquirrel wrote:\n>\n> @cyoung <https://github.com/cyoung> -- I've got this one. This will\n> just take adding a bounds check for GPS week into processNMEALine().\n>\n> U-blox tries to calculate a date from the GPS week number, even if\n> that value is null or invalid. This incorrect date is then reported in\n> the PUBX,04 message. Contrast to GxRMC, where date is left blank.\n>\n> |// cold boot: 00:02:32 $GPTXT,01,01,02,Resetting GPS*68 00:02:32\n> $GPTXT,01,01,02,ANTSTATUS=INIT*25 23:59:44\n> $GPTXT,01,01,02,ANTSTATUS=OK*3B ... // Invalid date #1 (Jan 12, 3236\n> ...65535 weeks after GPS epoch) 23:59:44 $GPRMC,,V,,,,,,,,,,N*53\n> 23:59:45 $PUBX,04,235945.00,120136,604785.00,65535,16D,0,0.000,21*5A\n> ... // Invalid date #2 (Jan 11, 1980.. week 0 of GPS epoch) 00:04:44\n> $GPRMC,000444.00,V,,,,,,,,,,N*79 00:04:44\n> $PUBX,04,000444.00,110180,432284.00,0,16D,0,0.000,21*5F ... Valid date\n> (Jan 1, 2016... week 1877 of GPS epoch) 00:06:03\n> $GPRMC,000603.00,V,,,,,,,010116,,,N*7F 00:06:03\n> $PUBX,04,000603.00,010116,432362.99,1877,16D,-30960396,0.000,21*7D |\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/cyoung/stratux/issues/177#issuecomment-168268432>.\n>\n\n"}}