1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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])
|