Ticket #8557: ddns.diff.txt

File ddns.diff.txt, 947 bytes (added by quiet.dragon@…, 6 years ago)

Patch to use monotonic time

Line 
1--- dynamic_dns_functions.sh.bak
2+++ dynamic_dns_functions.sh
3@@ -122,3 +122,10 @@
4                /usr/lib/ddns/dynamic_dns_updater.sh $section 0 > /dev/null 2>&1 &
5        done
6 }
7+
8+monotonic_time()
9+{
10+       local uptime
11+       read uptime < /proc/uptime
12+       echo "${uptime%%.*}"
13+}
14--- dynamic_dns_updater.sh.bak
15+++ dynamic_dns_updater.sh
16@@ -206,7 +206,7 @@
17 
18 
19 #determine when the last update was
20-current_time=$(date +%s)
21+current_time=$(monotonic_time)
22 last_update=$(( $current_time - (2*$force_interval_seconds) ))
23 if [ -e "/var/run/dynamic_dns/$service_id.update" ]
24 then
25@@ -231,7 +231,7 @@
26        current_ip=$(get_current_ip)
27 
28 
29-       current_time=$(date +%s)
30+       current_time=$(monotonic_time)
31        time_since_update=$(($current_time - $last_update))
32 
33 
34@@ -270,7 +270,7 @@
35                verbose_echo ""
36 
37                #save the time of the update
38-               current_time=$(date +%s)
39+               current_time=$(monotonic_time)
40                last_update=$current_time
41                time_since_update='0'
42                registered_ip=$current_ip