diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2015-03-31 00:38:23 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2015-03-31 00:38:23 -0400 |
commit | 2e4a91e8dac81838a2a35e7aed5a74c3ec098e0e (patch) | |
tree | 1d171a6f656fff34a9ce7d0dfb57582dfffef232 /ppsthread.h | |
parent | e59a564ceb7190a889a98dea3793bc7a9e6104ee (diff) | |
download | gpsd-2e4a91e8dac81838a2a35e7aed5a74c3ec098e0e.tar.gz |
ppsthread.[ch] and timespec_str.c are now fully detached from the rest of GPSD.
This means they could be dropped into NTP or another time-service program.
The only requirement is to set -DHAVE_SYS_TIMEPPS_H if you want the RFC2783
code compiled in.
Diffstat (limited to 'ppsthread.h')
-rw-r--r-- | ppsthread.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/ppsthread.h b/ppsthread.h index 3d4aece7..ae9c824c 100644 --- a/ppsthread.h +++ b/ppsthread.h @@ -6,6 +6,16 @@ #ifndef PPSTHREAD_H #define PPSTHREAD_H +#include <time.h> + +#ifndef TIMEDELTA_DEFINED +#define TIMEDELTA_DEFINED +struct timedelta_t { + struct timespec real; + struct timespec clock; +}; +#endif /* TIMEDELTA_DEFINED */ + /* use RFC 2782 PPS API */ /* this needs linux >= 2.6.34 and * CONFIG_PPS=y @@ -15,20 +25,10 @@ #if defined(HAVE_SYS_TIMEPPS_H) // include unistd.h here as it is missing on older pps-tools releases. // 'close' is not defined otherwise. -#include <unistd.h> #include <sys/time.h> #include <sys/timepps.h> #endif -#ifndef TIMEDELTA_DEFINED -#define TIMEDELTA_DEFINED -struct timedelta_t { - struct timespec real; - struct timespec clock; -}; -#endif /* TIMEDELTA_DEFINED */ - - /* difference between timespecs in nanoseconds */ /* int is too small, avoid floats */ /* WARNING! this will overflow if x and y differ by more than a few seconds */ |