diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2015-03-07 01:57:32 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2015-03-07 01:57:32 -0500 |
commit | e92b21041e00778c72362620ad9d62ffa94613db (patch) | |
tree | 2871a2dda9955daabb8efab913cd3b13684cb8f8 /ppsthread.h | |
parent | 02c9c43a3aaaf73f84fdf9fbc96e9a32e546d273 (diff) | |
download | gpsd-e92b21041e00778c72362620ad9d62ffa94613db.tar.gz |
Another step in prying ntplib loose. Partly decouple ppsthread.c fom sessions.
All regression tests pass.
Diffstat (limited to 'ppsthread.h')
-rw-r--r-- | ppsthread.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/ppsthread.h b/ppsthread.h new file mode 100644 index 00000000..ae7bd886 --- /dev/null +++ b/ppsthread.h @@ -0,0 +1,47 @@ +/* + * This file is Copyright (c) 2015 by the GPSD project + * BSD terms apply: see the file COPYING in the distribution root for details. + */ + +#ifndef PPSTHREAD_H +#define PPSTHREAD_H + +#include <stdbool.h> +#include <time.h> +#include <sys/time.h> +#include <sys/ipc.h> +#include <sys/shm.h> + +#ifndef HAVE_TIMEDELTA + +struct timedelta_t { + struct timespec real; + struct timespec clock; +}; + +#define HAVE_TIMEDELTA +#endif /* HAVE_TIMEDELTA */ + +struct pps_state_t { + volatile struct timedelta_t ppslast; + volatile int ppscount; +}; + +struct pps_fixtime_t { + timestamp_t real; + /* clock must be a timespec as it is in nSec and + * a timestamp_t will lose precision */ + struct timespec clock; /* system clock time when last fix received */ +}; + +#define PPS_THREAD_OK 0 +#define PPS_LOCK_ERR -1 +#define PPS_UNLOCK_ERR -2 + +extern int pps_thread_stash_fixtime(volatile struct pps_fixtime_t *, + timestamp_t, struct timespec); +extern int pps_thread_lastpps(struct pps_state_t *, struct timedelta_t *); + +#endif /* PPSTHREAD_H */ + +/* end */ |