+++ /dev/null
-#
-# Copyright (C) 2006-2014 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=ntpclient
-PKG_VERSION:=2015_365
-PKG_RELEASE:=4
-
-PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://doolittle.icarus.com/ntpclient
-PKG_HASH:=95c3646919a9a2278fa384aa8e37117b250577ff8b09b8c93ba53e04e729b54b
-
-PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
-
-PKG_LICENSE:=GPL-2.0
-
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-2015
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/ntpclient
- SUBMENU:=Time Synchronization
- SECTION:=net
- CATEGORY:=Network
- TITLE:=NTP (Network Time Protocol) client
- URL:=http://doolittle.icarus.com/ntpclient/
- DEPENDS:=+librt
-endef
-
-define Package/ntpclient/description
- NTP client for setting system time from NTP servers.
-endef
-
-define Package/ntpclient/conffiles
-/etc/config/ntpclient
-endef
-
-MAKE_FLAGS += \
- all adjtimex
-
-define Package/ntpclient/install
- $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
- $(INSTALL_DATA) ./files/ntpclient.hotplug $(1)/etc/hotplug.d/iface/20-ntpclient
- $(INSTALL_DIR) $(1)/etc/config
- $(INSTALL_CONF) ./files/ntpclient.config $(1)/etc/config/ntpclient
- $(INSTALL_DIR) $(1)/usr/sbin
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpclient $(1)/usr/sbin/
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/adjtimex $(1)/usr/sbin/
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/rate.awk $(1)/usr/sbin/
-endef
-
-$(eval $(call BuildPackage,ntpclient))
+++ /dev/null
-config ntpserver
- option hostname '0.openwrt.pool.ntp.org'
- option port '123'
-
-config ntpserver
- option hostname '1.openwrt.pool.ntp.org'
- option port '123'
-
-config ntpserver
- option hostname '2.openwrt.pool.ntp.org'
- option port '123'
-
-config ntpserver
- option hostname '3.openwrt.pool.ntp.org'
- option port '123'
-
-config ntpdrift
- option freq '0'
-
-config ntpclient
- option interval 600
- #option count 10
- #option interface wan
+++ /dev/null
-#!/bin/sh
-# Copyright (C) 2006-2014 OpenWrt.org
-
-. /lib/functions.sh
-
-unset SERVER
-unset PORT
-unset INTERVAL
-unset COUNT
-unset INTERFACE_GLOBAL
-
-NTPC=$(command -v ntpclient)
-
-check_server() {
- local hostname
- local port
- local interface
- [ -n "$SERVER" ] && return
- config_get hostname $1 hostname
- config_get port $1 port
- config_get interface $1 interface
-
- [ -z "$interface" ] && interface=$INTERFACE_GLOBAL
-
- [ -n "$interface" ] && {
- # $INTERFACE is passed from hotplug event
- [ "$interface" = "$INTERFACE" ] || return
- }
-
- [ -z "$hostname" ] && return
- $NTPC -c 1 -p ${port:-123} -i 2 -h $hostname > /dev/null && { SERVER=$hostname; PORT=${port:-123}; }
-}
-
-set_drift() {
- config_get freq $1 freq
- [ -n "$freq" ] && adjtimex -f $freq >/dev/null
-}
-
-start_ntpclient() {
- config_foreach set_drift ntpdrift
- config_foreach check_server ntpserver
- [ -z "$SERVER" ] && exit 0
- logger starting ntpclient
- $NTPC ${COUNT:+-c $COUNT} ${INTERVAL:+-i $INTERVAL} -s -l -D -p $PORT -h $SERVER 2> /dev/null
-}
-
-stop_ntpclient() {
- logger stopping ntpclient
- killall ntpclient
-}
-
-load_settings() {
- local interval
- local count
- local interface
-
- config_get interval $1 interval
- config_get count $1 count
- config_get interface $1 interface
-
- [ -n "$count" ] && COUNT=$count
- [ -n "$interval" ] && INTERVAL=$interval
- [ -n "$interface" ] && INTERFACE_GLOBAL=$interface
-}
-
-config_load ntpclient
-config_foreach load_settings ntpclient
-
-NTP_RUNNING=$(busybox ps | grep $NTPC | grep -v grep)
-
-case "${ACTION:-ifup}" in
- ifup)
- [ -z "$NTP_RUNNING" ] && start_ntpclient
- ;;
- ifdown)
- [ -n "$NTP_RUNNING" ] && stop_ntpclient
- ;;
-esac
+++ /dev/null
---- a/ntpclient.c
-+++ b/ntpclient.c
-@@ -608,7 +608,7 @@ int main(int argc, char *argv[]) {
- ntpc.cross_check=1;
-
- for (;;) {
-- c = getopt( argc, argv, "c:" DEBUG_OPTION "f:g:h:i:lp:q:" REPLAY_OPTION "st");
-+ c = getopt( argc, argv, "c:" DEBUG_OPTION "f:g:h:i:lp:q:" REPLAY_OPTION "stD");
- if (c == EOF) break;
- switch (c) {
- case 'c':
-@@ -657,6 +657,10 @@ int main(int argc, char *argv[]) {
- ntpc.cross_check = 0;
- break;
-
-+ case 'D':
-+ daemon(0, 0);
-+ break;
-+
- default:
- usage(argv[0]);
- exit(1);
+++ /dev/null
---- a/adjtimex.c
-+++ b/adjtimex.c
-@@ -36,6 +36,7 @@
- * gcc -Wall -O adjtimex_1.c -o adjtimex
- */
-
-+#include <inttypes.h>
- #include <stdio.h>
- #include <sys/types.h>
- #include <stdlib.h>
-@@ -143,12 +144,12 @@ int main(int argc, char ** argv)
- " precision: %ld\n"
- " tolerance: %ld\n"
- "-t tick: %ld\n"
-- " time.tv_sec: %ld\n"
-- " time.tv_usec: %ld\n"
-+ " time.tv_sec: %" PRId64 "\n"
-+ " time.tv_usec: %" PRId64 "\n"
- " return value: %d (%s)\n",
- txc.constant,
- txc.precision, txc.tolerance, txc.tick,
-- txc.time.tv_sec, txc.time.tv_usec, ret,
-+ (int64_t)txc.time.tv_sec, (int64_t)txc.time.tv_usec, ret,
- (ret >= 0 && ret <= 5) ? ret_code_descript[ret] : "error" );
- }
- return (ret<0);
---- a/ntpclient.c
-+++ b/ntpclient.c
-@@ -29,6 +29,7 @@
- * labelled "XXX fixme - non-automatic build configuration".
- */
-
-+#include <inttypes.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-@@ -181,7 +182,7 @@ static void set_time(struct ntptime *new
- exit(1);
- }
- if (debug) {
-- printf("set time to %lu.%.9lu\n", tv_set.tv_sec, tv_set.tv_nsec);
-+ printf("set time to %" PRId64 ".%.9" PRId64 "\n", (int64_t)tv_set.tv_sec, (int64_t)tv_set.tv_nsec);
- }
- #else
- /* Traditional Linux way to set the system clock
-@@ -196,7 +197,7 @@ static void set_time(struct ntptime *new
- exit(1);
- }
- if (debug) {
-- printf("set time to %lu.%.6lu\n", tv_set.tv_sec, tv_set.tv_usec);
-+ printf("set time to %" PRId64 ".%.6" PRId64 "\n", (int64_t)tv_set.tv_sec, (int64_t)tv_set.tv_usec);
- }
- #endif
- }
+++ /dev/null
---- a/ntpclient.c
-+++ b/ntpclient.c
-@@ -43,6 +43,9 @@
- #include <errno.h>
- #ifdef PRECISION_SIOCGSTAMP
- #include <sys/ioctl.h>
-+#ifdef __GLIBC__
-+#include <linux/sockios.h>
-+#endif
- #endif
- #ifdef USE_OBSOLETE_GETTIMEOFDAY
- #include <sys/time.h>