set time stamp in chrony SOCK sample correctly

This commit is contained in:
Miroslav Lichvar 2013-11-25 13:23:02 +01:00
parent 9260ac1fc3
commit 172405cbdb
2 changed files with 28 additions and 0 deletions

25
gpsd-chronyts.patch Normal file
View File

@ -0,0 +1,25 @@
commit 14ad8ddef480df52e090bfea65b4ae081c241506
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Fri Nov 22 18:19:42 2013 +0100
Set time stamp in chrony SOCK sample correctly.
The tv field should be the local time when was the sample received, not
the reference time. Otherwise the sample could be ignored as coming from
future.
Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
diff --git a/ntpshm.c b/ntpshm.c
index 109e4ea..fe8e450 100644
--- a/ntpshm.c
+++ b/ntpshm.c
@@ -351,7 +351,7 @@ static void chrony_send(struct gps_device_t *session, struct timedrift_t *td)
sample.leap = session->context->leap_notify;
sample.magic = SOCK_MAGIC;
/*@-type@*//* splint is confused about struct timespec */
- TSTOTV(&sample.tv, &td->real);
+ TSTOTV(&sample.tv, &td->clock);
/*@-compdef@*/
sample.offset = timespec_diff_ns(td->real, td->clock) / 1e9;
/*@+compdef@*/

View File

@ -15,6 +15,8 @@ Source11: gpsd.sysconfig
Patch1: gpsd-nolibcap.patch Patch1: gpsd-nolibcap.patch
# allow multiple options in LINKFLAGS # allow multiple options in LINKFLAGS
Patch2: gpsd-linkflags.patch Patch2: gpsd-linkflags.patch
# set time stamp in chrony SOCK sample correctly
Patch3: gpsd-chronyts.patch
BuildRequires: dbus-devel dbus-glib-devel ncurses-devel xmlto python-devel BuildRequires: dbus-devel dbus-glib-devel ncurses-devel xmlto python-devel
BuildRequires: scons desktop-file-utils bluez-libs-devel pps-tools-devel BuildRequires: scons desktop-file-utils bluez-libs-devel pps-tools-devel
@ -79,6 +81,7 @@ can run on a serial terminal or terminal emulator.
%setup -q %setup -q
%patch1 -p1 -b .nolibcap %patch1 -p1 -b .nolibcap
%patch2 -p1 -b .linkflags %patch2 -p1 -b .linkflags
%patch3 -p1 -b .chronyts
%build %build
export CCFLAGS="%{optflags}" export CCFLAGS="%{optflags}"