diff options
Diffstat (limited to 'ppsthread.h')
-rw-r--r-- | ppsthread.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ppsthread.h b/ppsthread.h index 73c8720b..4178813b 100644 --- a/ppsthread.h +++ b/ppsthread.h @@ -22,6 +22,20 @@ #endif #endif /* S_SPLINT_S */ +#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 */ +#define timespec_diff_ns(x, y) (long)(((x).tv_sec-(y).tv_sec)*1000000000+(x).tv_nsec-(y).tv_nsec) + struct pps_thread_t { struct timespec fixin_real; /* in-band time of the fix */ struct timespec fixin_clock; /* system clock time when fix received */ |