diff options
Diffstat (limited to 'recipes-support')
-rw-r--r-- | recipes-support/ntp/files/logtime.patch | 79 | ||||
-rw-r--r-- | recipes-support/ntp/files/ntp.conf.patch | 4 | ||||
-rw-r--r-- | recipes-support/ntp/ntp_4.2.6p5.bbappend | 1 |
3 files changed, 82 insertions, 2 deletions
diff --git a/recipes-support/ntp/files/logtime.patch b/recipes-support/ntp/files/logtime.patch new file mode 100644 index 0000000..6b104ce --- /dev/null +++ b/recipes-support/ntp/files/logtime.patch @@ -0,0 +1,79 @@ + Create a test to log time since boot MONOTONIC_RAW or uptime + and the REALTIME clock (UTC) + Not real sure how the build should work. To build logtime + do bitbake -c devshell ntp + Then cd clockstuff, and to: + make logtime +============================================================== +diff -Naur old/clockstuff/logtime.c new/clockstuff/logtime.c +--- old/clockstuff/logtime.c 1969-12-31 18:00:00.000000000 -0600 ++++ new/clockstuff/logtime.c 2017-01-27 16:55:46.420307603 -0600 +@@ -0,0 +1,44 @@ ++#include <time.h> ++#include <stdio.h> ++#include <unistd.h> ++#include <stdarg.h> ++#include <syslog.h> ++/* ++ * Generate a log messages 4 times per second ++ * to verify leap second. The CLOCK_MONOTONIC_RAW ++ * is the time since boot unaffected by adjustments. ++ * ++ * CLOCK_REALTIME is the UTC clock, which is affected ++ * by leap seconds. ++ * ++ * Program does not exit. ++ * ++ */ ++main() ++{ ++ openlog("CTST",0,LOG_LOCAL2); ++ while(1) { ++ struct timespec ts,unused,ep; ++ if (clock_gettime(CLOCK_MONOTONIC,&ts) == 0) { ++ ++ if(ts.tv_nsec < 750000000) ++ ts.tv_nsec += 250000000; ++ else { ++ ts.tv_nsec -= 750000000; ++ ts.tv_sec += 1; ++ } ++ clock_nanosleep(CLOCK_MONOTONIC,TIMER_ABSTIME,&ts,&unused); ++ clock_gettime(CLOCK_MONOTONIC_RAW,&ts); ++ ts.tv_nsec /= 1000000; ++ clock_gettime(CLOCK_REALTIME,&ep); ++ ep.tv_nsec /= 1000000; ++ syslog(LOG_NOTICE,"epoch: %lu.%3.3ld boot: %lu.%3.3ld", ++ ep.tv_sec,ep.tv_nsec, ++ ts.tv_sec,ts.tv_nsec); ++ ++ } ++ ++ ++ } ++ ++} +diff -Naur old/clockstuff/Makefile.am new/clockstuff/Makefile.am +--- old/clockstuff/Makefile.am 2017-01-27 16:50:58.929973639 -0600 ++++ new/clockstuff/Makefile.am 2017-01-27 16:53:22.625139584 -0600 +@@ -1,7 +1,7 @@ + #AUTOMAKE_OPTIONS = ../ansi2knr no-dependencies + AUTOMAKE_OPTIONS = +-noinst_PROGRAMS = @PROPDELAY@ @CHUTEST@ @CLKTEST@ +-EXTRA_PROGRAMS = propdelay chutest clktest ++noinst_PROGRAMS = @PROPDELAY@ @CHUTEST@ @CLKTEST@ @LOGTIME@ ++EXTRA_PROGRAMS = propdelay chutest clktest logtime + + INCLUDES = -I$(top_srcdir)/include + # We need -lm (and perhaps $(COMPAT) for propdelay, -lntp for {chu,clk}test +diff -Naur old/configure.ac new/configure.ac +--- old/configure.ac 2017-01-27 17:59:46.940532782 -0600 ++++ new/configure.ac 2017-01-27 17:55:26.626841232 -0600 +@@ -4115,6 +4115,7 @@ + AC_SUBST([PROPDELAY]) dnl Set to "propdelay" + AC_SUBST([CHUTEST]) dnl Set to "chutest" + AC_SUBST([CLKTEST]) dnl Set to "clktest" ++AC_SUBST([LOGTIME]) dnl Set to "logtime" + + AC_SUBST([MAKE_ADJTIMED]) + AC_MSG_CHECKING([if we want HP-UX adjtimed support]) diff --git a/recipes-support/ntp/files/ntp.conf.patch b/recipes-support/ntp/files/ntp.conf.patch index 2fd26ef..dbb7fb8 100644 --- a/recipes-support/ntp/files/ntp.conf.patch +++ b/recipes-support/ntp/files/ntp.conf.patch @@ -36,11 +36,11 @@ diff -Naur old/ntp.conf new/ntp.conf + +# GPS Serial data reference (NTP0) +# This sets the GPS 50 milliseconds slower than the PPS. -+server 127.127.28.0 ++server 127.127.28.0 true +fudge 127.127.28.0 time1 0.050 refid GPS + +# GPS PPS reference (NTP2) -+server 127.127.28.2 prefer ++server 127.127.28.2 prefer true +fudge 127.127.28.2 time1 0.000 refid PPS + # Using local hardware clock as fallback diff --git a/recipes-support/ntp/ntp_4.2.6p5.bbappend b/recipes-support/ntp/ntp_4.2.6p5.bbappend index bfc716a..a72f7bd 100644 --- a/recipes-support/ntp/ntp_4.2.6p5.bbappend +++ b/recipes-support/ntp/ntp_4.2.6p5.bbappend @@ -3,6 +3,7 @@ PR .= ".mlinux2" SRC_URI += " file://ntpd-init.patch;patchdir=.. \ file://ntp.conf.patch;patchdir=.. \ file://ntpd-default \ + file://logtime.patch \ " FILESEXTRAPATHS_prepend := "${THISDIR}/files" |