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 <[EMAIL PROTECTED]>

Index: ntpclient/files/ntpclient.hotplug
===================================================================
--- ntpclient/files/ntpclient.hotplug   (revision 10180)
+++ ntpclient/files/ntpclient.hotplug   (working copy)
@@ -9,7 +9,18 @@
        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
                        config_get port         $cfg port
Index: ntpclient/files/ntpclient.config
===================================================================
--- ntpclient/files/ntpclient.config    (revision 10180)
+++ ntpclient/files/ntpclient.config    (working copy)
@@ -7,3 +7,6 @@
        option hostname 'ntp.ubuntu.com'
        option port     '123'
        option count    '1'
+
+config ntpdrift
+       option freq     '0'
_______________________________________________
openwrt-devel mailing list
[email protected]
http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to