ntpclient: initial frequency offset configuration and adjtimex invocation
authorFelix Fietkau <nbd@openwrt.org>
Sat, 2 Feb 2008 02:13:58 +0000 (02:13 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 2 Feb 2008 02:13:58 +0000 (02:13 +0000)
This adds a new config file section "ntpdrift" to /etc/config/ntpclient
to support setting an initial value "freq" for frequency offset.
Changes /etc/hotplug.d/iface/20-ntpclient to call adjtimex
and do an initial frequency offset before starting ntpclient.

Signed-off-by: Steffen Hoffmann <hoff.st@shaas.net>
SVN-Revision: 10355

net/ntpclient/files/ntpclient.config
net/ntpclient/files/ntpclient.hotplug

index 25a6269b9d6d2bc3ca614c93f3fc081505c506e8..0d9c01041f8fffb614a128a078f99d8f4b1a3e1c 100644 (file)
@@ -17,3 +17,6 @@ config ntpclient
        option hostname '3.openwrt.pool.ntp.org'
        option port     '123'
        option count    '1'
+
+config ntpdrift
+       option freq     '0'
index 2abb0361fc7071b6f5d316f01d67e33df86641a5..403be9d6125428ed84f4a839f0f9f8b50004f63b 100644 (file)
@@ -9,6 +9,17 @@ config_cb() {
        local cfgtype
        config_get cfgtype "$cfg" TYPE
 
+       # initial frequency offset, if configured
+       case "$cfgtype" in
+               ntpdrift)
+                       config_get freq         $cfg freq
+
+                       if [ ! "$freq" = "" ]; then
+                               adjtimex -f $freq
+                       fi
+               ;;
+       esac
+
        case "$cfgtype" in
                ntpclient)
                        config_get hostname     $cfg hostname