summaryrefslogtreecommitdiff
path: root/timehint.c
Commit message (Collapse)AuthorAgeFilesLines
* Eliminate effectively all uses of struct timeval.Eric S. Raymond2018-12-261-1/+1
| | | | | Outide of one Mac portability shim, anyway. Associated select(2) calls become pselect(2) calls.
* LICENSE: Update licenses for consistency. No functional changes.Gary E. Miller2018-11-191-2/+2
|
* Adds Linux "fake PPS" detection and avoidance.Fred Wright2016-12-231-6/+9
| | | | | | | | | | | | | | | | | | | | | If the Linux kernel is built with CONFIG_PPS_CLIENT_KTIMER=y, then a synthetic PPS source is added to allow testing without a real PPS source. However, this source doesn't even run at exactly 1Hz, so any attempt to use it for real time synchronization is disastrous. To make matters worse, this is usually the first PPS driver configured, causing it to appear as /dev/pps0, which is the implied PPS device used by the "Magic HAT" kludge. This change adds detection for the fake source (based on its name), both to provide a warning if it is configured explicitly, and to skip over it when applying the "Magic HAT" kludge. TESTED: Tested both gpsmon and gpsd on a Beaglebone Black with added symlinks for testing "Magic HAT". Did this with kernels with and without the KTIMER enabled. Verified that the proper PPS device is selected by "Magic HAT", and that a warning is generated when expected.
* Makes MAGIC_HAT kludge optional.Fred Wright2016-12-221-2/+4
| | | | | | | | | | | | | | This adds a build option called 'magic_hat', and makes the code for MAGIC_HAT_GPS and MAGIC_LINK_GPS conditional on it. It currently defaults to True on Linux and False otherwise. It's meaningless on non-Linux platforms, though at present there are no conditionally-present options, so this one is also present on all platforms. TESTED: Tested on a Beaglebone Black with suitable symlinks added (and running a kernel with PPS_CLIENT_KTIMER turned off. Verified that the kludge behaves as intended when enabled, and is inoperative when disabled.
* Fix format string.Beat Bolli2016-12-111-1/+1
| | | | | | | | | 149f329e ("ntpd uses precision as a floor, so do not be conservative.", 2016-10-10) changed the log output of "pps" or "clock" to the numeric precision without also updating the gpsd_log() format string, causing a SIGSEGV when running with -D4 or above. Signed-off-by: Beat Bolli <dev@drbeat.li>
* Make the code fit the comment.Gary E. Miller2016-10-151-1/+1
|
* ntpd uses precision as a floor, so do not be conservative.Gary E. Miller2016-10-101-9/+9
| | | | precision -20 is 1 micro Sec, -30 is one nano sec
* No need to escape the DARWIN defines.Gary E. Miller2016-09-071-1/+2
|
* Hack around FreeBSD stupidity.Gary E. Miller2016-09-071-0/+3
| | | | | | When FreeBSD turns on POSIX it disables BSd extenstions, with no possible workaraound. So just don;t ask for POSIX when then insanity becomes visible.
* Comment why time.h neededGary E. Miller2016-08-161-1/+1
|
* Fixups for NetBSDGary E. Miller2016-08-161-0/+1
|
* __DARWIN_C_LEVEL and _DARWIN_C_SOURCE to silence some warnings.Gary E. Miller2016-08-161-0/+4
| | | | vsnprintf() and strlcmp() are happier now.
* nice() needs _XOPEN_SOURCE 500 definedGary E. Miller2016-08-151-0/+3
|
* Modify misleading comment on leap seconds.Gary E. Miller2016-07-191-2/+7
|
* Thinko fix.Eric S. Raymond2016-05-111-1/+1
|
* Im[p;ement and document /dev/gpsd0 side effect.Eric S. Raymond2016-05-101-2/+3
|
* Use MAGIC_HAT_GPS consistently.Eric S. Raymond2016-05-051-4/+5
|
* Autoconfiguration kluge for Raspberry Pi.Eric S. Raymond2016-04-251-0/+8
| | | | | | | | | When a serial device to be opened is /dev/ttyAMA0, and /dev/pps0 exists, and we have read-write access to it (which implies running as root), substitute /dev/pps0 for the device name in the thread context so we use KPPS. Should be safe because /dev/ttyAMA0 is so specific to the Raspberry Pi.
* PPSTIME -> NTPTIMEGary E. Miller2016-04-241-1/+1
| | | | | NTPTIME is from the serial stream, it never had anything to do with PPS and it just confused everyone.
* Rename PPS_M IN_FIXES to NTP_MIN_FIXESGary E. Miller2016-04-131-1/+1
| | | | | | | | | This applies to not just PPS, but all NTP reportable time. Even with a valid fix, the frist 3 times may be off. Don't send bad time to ntp/chrony. Move the definition into gpsd.h to be widely available not depending on scons options.
* Bad NMEA time was still leaking, require 3 fixes for time.Gary E. Miller2016-04-051-2/+0
|
* Introduce the flag GOODTIME_IS...HTJ2016-03-221-1/+2
| | | | | | | | ...to mark that the device has a good time even if it does not report a position fix. Used by the OnCore driver, e.g. when in position hold mode. scons check passes
* Don't claim to be able to deliver a 3D fix in UBX timing mode.Eric S. Raymond2016-03-201-2/+0
|
* Trailing whitespace fixup.Gary E. Miller2015-04-301-15/+15
|
* Move ntpshm_put() logging to PROG from RAW.Gary E. Miller2015-04-011-1/+1
| | | | Only once a second.
* Prefix all NTP logs with NTP:Gary E. Miller2015-04-011-6/+6
| | | | This makes it easy to pick oout the time logs. Along with PPS:
* Whoops, a pointer, not a pointer to a pointer.Gary E. Miller2015-04-011-6/+13
| | | | /dev/pps0 actually seems to work.
* Remove validations on /dev/pps0 time that can never work.Gary E. Miller2015-04-011-14/+20
| | | | | | /dev/pps0 now ships time to NTP SHM. Very wrong time... last_fixtime is all wacky...
* Do not double increment the last_fixtime.Gary E. Miller2015-04-011-13/+3
|
* non PPS typo in timehint.c (off by one on the } )Hal Murray2015-04-011-1/+1
|
* Eliminate some duplication code for timespec arithmetic.Eric S. Raymond2015-04-011-1/+1
|
* Stop making the assumption that device cycle time is 1 second in ppsthread.c.Eric S. Raymond2015-04-011-3/+13
| | | | | | | | Instead, pass out real time of last PPS as it was actually seen. We can then correct it using the device's actual cycle time. The correction currently only works for cycle times that are integral multiples of a second.
* Further thread-monitor interface simplification.Eric S. Raymond2015-04-011-8/+2
| | | | | | Remove the wrap hook. The only thing it was doing was closing the chrony fd. which can be done just as cleanly by whatever calls the pps_thread_deactivate() function.
* Thread monitor interface simplification.Eric S. Raymond2015-04-011-0/+4
| | | | | | With a bit of refactoring we can eliminate one of the hooks. PPS observed live, telnetting to localhost:2947 with gpsd running.
* Another small step to /dev/ppsX. ppsthread now looping fine, no time yet.Gary E. Miller2015-03-311-8/+15
|
* Retire splint from our set of static analyzers.Eric S. Raymond2015-03-301-33/+3
| | | | | | | | | | | | | | | | | | | The proximate cause was that we've been seing emission of error messages that were randomly and disturbingly variable across different environments - notably Raspbian and Gentoo splint gave nontrivially different results than Ubuntu 14.10 splint. And this was *not* due to Ubuntu patches! A pristine splint built from the 3.1.2 tarball on Ubuntu didn't match the Raspbian and Gentoo results either. But this has been coming for a while. Easy access to more modern static analyzers such as coverity, scan-build and cppcheck has been decreasing the utility of splint, which is unmaintained and somewhat buggy and not easy to use. Only file not cleaned is ppsthread.c, because Gary has been working on it during this cleanup. All regression tests pass. PPS observed live on GR601-W.
* More offerings to the splint god.Gary E. Miller2015-03-281-1/+9
|
* Remove unnedded splint over ride.Gary E. Miller2015-03-251-1/+1
|
* Add root device name to PPS debug output.Gary E. Miller2015-03-191-3/+6
| | | | | | | | With more than one PPS thread going at a time hard to know which is which without help. Also remove restriction that devicename is a tty since /dev/ppsX is not a tty.
* splint/cppcheck/coverity prerelease cleanup.Eric S. Raymond2015-03-131-1/+1
|
* Comment fix.Eric S. Raymond2015-03-111-1/+1
|
* Add a lst minute check in chrony send to validate leap notify.Gary E. Miller2015-03-101-2/+15
| | | | | | | | Same fix as in ntpshmwrite.c. GPS may notify about upcoming leap second long before NTP can handle it. So limit leap notify to months of June and December. Per Hall Murray and http://bugs.ntp.org/1090
* chronfd doesn't belong in the thread context, move it back out to session.Eric S. Raymond2015-03-081-8/+8
|
* Break timespec_str out of gpsutils.c.Eric S. Raymond2015-03-081-0/+1
| | | | | | It's not used on the client side, and it's needed separately for ntplib. All regression tesrs pass. PPS is live.
* Decouple (mostly) the PPS thread-monitor from the session structure.Eric S. Raymond2015-03-081-4/+6
| | | | | | | | | | | | This is the big step towards ntplib. A couple of minor issues remain to be ironed out, the most significant of which is what to do about the timestamp_t type. This changes some field offsets of private fields in struct gps_device_t. Probably does not require a version bump as access to them is all through the libgpsd API. All regression tests pass. PPS observed live in gpsmon direct mode.
* gpsd-report() -> gpsd_log()Eric S. Raymond2015-03-071-29/+29
| | | | | | | | | | | | | | | | This change is done so we can add a "log" hook to the pps_thread_t structure (this is not done yet) and harmonize with the name of the outer logging function. If that name had been left as gpsd_report() there would have been scope for bad confusion with the report_hook member. Also, remove two stray duplicative printf calls from the NMEA2000 driver (drivers shouldn't have printfs!) and fix one typo. This is a step towards factoring out ntplib. For that to happen, the PPS thread code needs to be decoupled from the core session structure. No logic changes. Object compatibility preserved. All regression tests pass.
* Factor PPS-related members of struct gps_device_t into a pps_thread_t structure.Eric S. Raymond2015-03-071-10/+10
| | | | | | | | | | | No logic changes, though it looks like there are two because two guards that would always have failed when the code was compiled with pps=off are now conditioned out. Also, this code is offset-preserving so as not to break link-time compatibility of libgpsd. (This is the subtler approach...) All regression tests pass.
* Begin factoring out ntplib.Eric S. Raymond2015-03-071-0/+440
All knowledge of the ntpd SHM format is now confined to the three files ntpshm.h, ntpshmread.c, and ntpshmwrite.c. No logic changes. All regression tests pass. PPS works on GR-601W.