1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- #ifndef GPSD_NTPSHM_H
- #define GPSD_NTPSHM_H
- #include <stdbool.h>
- #include <time.h>
- #include <sys/time.h>
- #include <sys/ipc.h>
- #include <sys/shm.h>
- #define NTPD_BASE 0x4e545030
- struct shmTime
- {
- int mode;
- volatile int count;
- time_t clockTimeStampSec;
- int clockTimeStampUSec;
- time_t receiveTimeStampSec;
- int receiveTimeStampUSec;
- int leap;
- int precision;
- int nsamples;
- volatile int valid;
- unsigned clockTimeStampNSec;
- unsigned receiveTimeStampNSec;
- int dummy[8];
- };
- enum segstat_t {OK, NO_SEGMENT, NOT_READY, BAD_MODE, CLASH};
- struct shm_stat_t {
- enum segstat_t status;
- struct timespec tvc;
- struct timespec tvr;
- struct timespec tvt;
- int precision;
- int leap;
- };
- #ifndef TIMEDELTA_DEFINED
- struct timedelta_t {
- struct timespec real;
- struct timespec clock;
- };
- #define TIMEDELTA_DEFINED
- #endif
- struct shmTime *shm_get(int, bool, bool);
- extern char *ntp_name(const int);
- enum segstat_t ntp_read(struct shmTime *, struct shm_stat_t *, const bool);
- void ntp_write(volatile struct shmTime *, struct timedelta_t *, int, int);
- #endif
|