[packages] ddns-scripts: use /proc/uptime as time reference, this makes it immune...
authorjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sat, 1 Jan 2011 16:52:37 +0000 (16:52 +0000)
committerjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sat, 1 Jan 2011 16:52:37 +0000 (16:52 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@24869 3c298f89-4303-0410-b956-a3cf2f4a3e73

net/ddns-scripts/Makefile
net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh
net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh

index af14e53..add0ee8 100644 (file)
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ddns-scripts
 PKG_VERSION:=1.0.0
-PKG_RELEASE:=10
+PKG_RELEASE:=11
 
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 
index 0e2ab7f..19effef 100644 (file)
@@ -122,3 +122,10 @@ start_daemon_for_all_ddns_sections()
                /usr/lib/ddns/dynamic_dns_updater.sh $section 0 > /dev/null 2>&1 &
        done
 }
+
+monotonic_time()
+{
+       local uptime
+       read uptime < /proc/uptime
+       echo "${uptime%%.*}"
+}
index 1cab8aa..a58b307 100755 (executable)
@@ -206,7 +206,7 @@ echo $$ > /var/run/dynamic_dns/$service_id.pid
 
 
 #determine when the last update was
-current_time=$(date +%s)
+current_time=$(monotonic_time)
 last_update=$(( $current_time - (2*$force_interval_seconds) ))
 if [ -e "/var/run/dynamic_dns/$service_id.update" ]
 then
@@ -231,7 +231,7 @@ do
        current_ip=$(get_current_ip)
 
 
-       current_time=$(date +%s)
+       current_time=$(monotonic_time)
        time_since_update=$(($current_time - $last_update))
 
 
@@ -270,7 +270,7 @@ do
                verbose_echo ""
 
                #save the time of the update
-               current_time=$(date +%s)
+               current_time=$(monotonic_time)
                last_update=$current_time
                time_since_update='0'
                registered_ip=$current_ip