Changeset 24869


Ignore:
Timestamp:
2011-01-01T17:52:37+01:00 (7 years ago)
Author:
jow
Message:

[packages] ddns-scripts: use /proc/uptime as time reference, this makes it immune against time warps (#8557)

Location:
packages/net/ddns-scripts
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • packages/net/ddns-scripts/Makefile

    r24193 r24869  
    33PKG_NAME:=ddns-scripts 
    44PKG_VERSION:=1.0.0 
    5 PKG_RELEASE:=10 
     5PKG_RELEASE:=11 
    66 
    77PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) 
  • packages/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh

    r21512 r24869  
    123123        done 
    124124} 
     125 
     126monotonic_time() 
     127{ 
     128        local uptime 
     129        read uptime < /proc/uptime 
     130        echo "${uptime%%.*}" 
     131} 
  • packages/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh

    r24193 r24869  
    207207 
    208208#determine when the last update was 
    209 current_time=$(date +%s) 
     209current_time=$(monotonic_time) 
    210210last_update=$(( $current_time - (2*$force_interval_seconds) )) 
    211211if [ -e "/var/run/dynamic_dns/$service_id.update" ] 
     
    232232 
    233233 
    234         current_time=$(date +%s) 
     234        current_time=$(monotonic_time) 
    235235        time_since_update=$(($current_time - $last_update)) 
    236236 
     
    271271 
    272272                #save the time of the update 
    273                 current_time=$(date +%s) 
     273                current_time=$(monotonic_time) 
    274274                last_update=$current_time 
    275275                time_since_update='0' 
Note: See TracChangeset for help on using the changeset viewer.