Browse Source

fixup! [fix] Sync the date with http if ntp can't (#40)

pitchum 7 years ago
parent
commit
d6f5f33b61
1 changed files with 3 additions and 3 deletions
  1. 3 3
      conf/ynh-vpnclient

+ 3 - 3
conf/ynh-vpnclient

@@ -205,12 +205,12 @@ sync_time() {
   # Try to get the date with an http request on the internetcube web site
   # Try to get the date with an http request on the internetcube web site
   if [ $? -ne 0 ]; then
   if [ $? -ne 0 ]; then
     http_date=`curl -sD - labriqueinter.net | grep '^Date:' | cut -d' ' -f3-6`
     http_date=`curl -sD - labriqueinter.net | grep '^Date:' | cut -d' ' -f3-6`
-    http_date=`date -d "${http_date}" +%s`
-    current_date=`date +%s`
+    http_date_seconds=`date -d "${http_date}" +%s`
+    curr_date_seconds=`date +%s`
 
 
     # Set the new date if it's greater than the current date
     # Set the new date if it's greater than the current date
     # So it does if 1970 year or if old fake-hwclock date is used
     # So it does if 1970 year or if old fake-hwclock date is used
-    if [ $http_date -ge $current_date ]; then
+    if [ $http_date_seconds -ge $curr_date_seconds ]; then
       date -s "${http_date}"
       date -s "${http_date}"
     fi
     fi
   fi 
   fi