chiark / gitweb /
timesyncd: add unit and man page
authorKay Sievers <kay@vrfy.org>
Tue, 29 Apr 2014 06:57:51 +0000 (08:57 +0200)
committerKay Sievers <kay@vrfy.org>
Tue, 29 Apr 2014 07:51:53 +0000 (09:51 +0200)
Makefile-man.am
Makefile.am
configure.ac
man/systemd-timesyncd.service.xml [new file with mode: 0644]
src/timesync/timesyncd.c
units/.gitignore
units/systemd-timesyncd.service.in [new file with mode: 0644]

index 60ee991..262e4b1 100644 (file)
@@ -1126,6 +1126,17 @@ man/systemd-timedated.html: man/systemd-timedated.service.html
 
 endif
 
+if ENABLE_TIMESYNCD
+MANPAGES += \
+       man/systemd-timesyncd.service.8
+MANPAGES_ALIAS += \
+       man/systemd-timesyncd.8
+man/systemd-timesyncd.8: man/systemd-timesyncd.service.8
+man/systemd-timesyncd.html: man/systemd-timesyncd.service.html
+       $(html-alias)
+
+endif
+
 if ENABLE_VCONSOLE
 MANPAGES += \
        man/systemd-vconsole-setup.service.8 \
@@ -1550,6 +1561,7 @@ EXTRA_DIST += \
        man/systemd-system-update-generator.xml \
        man/systemd-system.conf.xml \
        man/systemd-timedated.service.xml \
+       man/systemd-timesyncd.service.xml \
        man/systemd-tmpfiles.xml \
        man/systemd-tty-ask-password-agent.xml \
        man/systemd-udevd.service.xml \
index 7783882..4661a2a 100644 (file)
@@ -4023,8 +4023,14 @@ systemd_timesyncd_LDADD = \
        libsystemd-shared.la \
        -lm
 
-noinst_PROGRAMS += \
+rootlibexec_PROGRAMS += \
        systemd-timesyncd
+
+nodist_systemunit_DATA += \
+       units/systemd-timesyncd.service
+
+EXTRA_DIST += \
+       units/systemd-timesyncd.service.in
 endif
 
 # ------------------------------------------------------------------------------
index 7674485..02561b5 100644 (file)
@@ -822,7 +822,7 @@ AM_CONDITIONAL(ENABLE_TIMEDATED, [test "$have_timedated" = "yes"])
 # ------------------------------------------------------------------------------
 have_timesyncd=no
 AC_ARG_ENABLE(timesyncd, AS_HELP_STRING([--disable-timesyncd], [disable timesync daemon]))
-if test "x$enable_timesyncd" != "xno"; then
+if test "x$enable_timesyncd" = "xyes"; then
         have_timesyncd=yes
 fi
 AM_CONDITIONAL(ENABLE_TIMESYNCD, [test "$have_timesyncd" = "yes"])
@@ -1158,6 +1158,7 @@ AC_MSG_RESULT([
         machined:                ${have_machined}
         hostnamed:               ${have_hostnamed}
         timedated:               ${have_timedated}
+        timesyncd:               ${have_timesyncd}
         localed:                 ${have_localed}
         networkd:                ${have_networkd}
         coredump:                ${have_coredump}
diff --git a/man/systemd-timesyncd.service.xml b/man/systemd-timesyncd.service.xml
new file mode 100644 (file)
index 0000000..84c4899
--- /dev/null
@@ -0,0 +1,74 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+        "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<!--
+  This file is part of systemd.
+
+  Copyright 2014 Kay Sievers
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<refentry id="systemd-timesyncd.service" conditional='ENABLE_TIMESYNCD'>
+
+        <refentryinfo>
+                <title>systemd-timesyncd.service</title>
+                <productname>systemd</productname>
+
+                <authorgroup>
+                        <author>
+                                <contrib>Developer</contrib>
+                                <firstname>Kay</firstname>
+                                <surname>Sievers</surname>
+                                <email>kay@vrfy.org</email>
+                        </author>
+                </authorgroup>
+        </refentryinfo>
+
+        <refmeta>
+                <refentrytitle>systemd-timesyncd.service</refentrytitle>
+                <manvolnum>8</manvolnum>
+        </refmeta>
+
+        <refnamediv>
+                <refname>systemd-timesyncd.service</refname>
+                <refname>systemd-timesyncd</refname>
+                <refpurpose>Network Time Synchronization</refpurpose>
+        </refnamediv>
+
+        <refsynopsisdiv>
+                <para><filename>systemd-timesyncd.service</filename></para>
+                <para><filename>/usr/lib/systemd/systemd-timesyncd</filename></para>
+        </refsynopsisdiv>
+
+        <refsect1>
+                <title>Description</title>
+
+                <para><filename>systemd-timesyncd</filename> is a
+                system service that may be used to synchronize the local
+                system clock with a Network Time Protocol Server.</para>
+        </refsect1>
+
+        <refsect1>
+                <title>See Also</title>
+                <para>
+                        <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+                        <citerefentry><refentrytitle>timedatectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+                        <citerefentry><refentrytitle>localtime</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                        <citerefentry><refentrytitle>hwclock</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+                </para>
+        </refsect1>
+
+</refentry>
index 5bd61dd..6ec8139 100644 (file)
@@ -627,8 +627,8 @@ static int sntp_receive_response(sd_event_source *source, int fd, uint32_t reven
                   m->samples_jitter, spike ? " spike" : "",
                   m->poll_interval_usec / USEC_PER_SEC);
 
-        log_info("%4llu %+10f %10f %10f%s",
-                 m->poll_interval_usec / USEC_PER_SEC, offset, delay, m->samples_jitter, spike ? " spike" : "");
+        log_info("poll=%llu s offset=%+f s roundtrip=%f s",
+                 m->poll_interval_usec / USEC_PER_SEC, offset, delay);
 
         if (!spike) {
                 r = sntp_adjust_clock(m, offset, leap_sec);
@@ -771,9 +771,7 @@ int main(int argc, char *argv[]) {
         if (r < 0)
                 goto out;
 
-        //server = "216.239.32.15";       /* time1.google.com */
-        //server = "192.53.103.108";      /* ntp1.ptb.de */
-        server = "27.54.95.11";         /* au.pool.ntp.org */
+        server = "216.239.32.15";       /* time1.google.com */
 
         sd_notifyf(false,
                   "READY=1\n"
index 3bae4b4..fca17c9 100644 (file)
@@ -54,6 +54,7 @@
 /systemd-suspend.service
 /systemd-sysctl.service
 /systemd-timedated.service
+/systemd-timesyncd.service
 /systemd-tmpfiles-clean.service
 /systemd-tmpfiles-setup-dev.service
 /systemd-tmpfiles-setup.service
diff --git a/units/systemd-timesyncd.service.in b/units/systemd-timesyncd.service.in
new file mode 100644 (file)
index 0000000..4a363f7
--- /dev/null
@@ -0,0 +1,20 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+
+[Unit]
+Description=Network Time Synchronization
+Documentation=man:systemd-timesyncd.service(8)
+ConditionCapability=CAP_SYS_TIME
+
+[Service]
+Type=notify
+Restart=always
+RestartSec=0
+ExecStart=@rootlibexecdir@/systemd-timesyncd
+
+[Install]
+WantedBy=multi-user.target