summaryrefslogtreecommitdiffstats
path: root/app/gps.c
diff options
context:
space:
mode:
authorroot <root@lab.panaceas.james.local>2019-02-19 19:47:19 +0000
committerroot <root@lab.panaceas.james.local>2019-02-19 19:47:19 +0000
commit379b0ec3e5eacdde822966c84062bea41da7ae89 (patch)
treea126770df052c3e735cdf09a32e5d58593c3c4ec /app/gps.c
parent9bbf1d200534cd946c4776e29457f989147b45b2 (diff)
downloadclock-379b0ec3e5eacdde822966c84062bea41da7ae89.tar.gz
clock-379b0ec3e5eacdde822966c84062bea41da7ae89.tar.bz2
clock-379b0ec3e5eacdde822966c84062bea41da7ae89.zip
Working
Diffstat (limited to 'app/gps.c')
-rw-r--r--app/gps.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/app/gps.c b/app/gps.c
index b0bc433..7e2fd1b 100644
--- a/app/gps.c
+++ b/app/gps.c
@@ -185,25 +185,30 @@ ubx_recv_utc (uint8_t *ptr, unsigned len)
ptr += ubx_get_u8 (ptr, &min);
ptr += ubx_get_u8 (ptr, &sec);
-// printf ("gps %02d:%02d:%02d %09d\r\n", (int) hour, (int) min, (int) sec, (int) nano);
+ // printf ("gps %02d:%02d:%02d %09d\r\n", (int) hour, (int) min, (int) sec, (int) nano);
-{
- UTC u;
- EPOCH gps_time;
+ {
+ UTC u;
+ EPOCH gps_time;
+ uint32_t now;
+ uint64_t abs;
- u.jday = 0;
- u.year = year;
- u.month = month;
- u.mday = day;
- u.hour = hour;
- u.minute = min;
- u.second = sec;
- u.nanosecond = 0;
+ u.jday = 0;
+ u.year = year;
+ u.month = month;
+ u.mday = day;
+ u.hour = hour;
+ u.minute = min;
+ u.second = sec;
+ u.nanosecond = 0;
- gps_time = time_utc_to_epoch (u);
+ gps_time = time_utc_to_epoch (u);
- pll_set_offset (gps_time, abs);
-}
+
+ now = SCS_DWT_CYCCNT;
+ abs = abs_extend (now);
+ pll_set_offset (gps_time, abs);
+ }
#if 0
@@ -437,7 +442,7 @@ static void gps_pps_dispatch (void)
if (!v) return;
- abs=abs_extend(now);
+ abs = abs_extend (now);