Browse Source

BSD fix _time2str()

date -u -d@"12345" does not produce an error on *BSD and outputs the
current date in UTC, which is not the expected output from _time2str()

Fix, reorder _time2str() to attempt BSD style date first, which
errors on Linux, so cascade style OS detection works correctly.
Jesse Miller 6 years ago
parent
commit
cb11580981
1 changed files with 5 additions and 5 deletions
  1. 5 5
      acme.sh

+ 5 - 5
acme.sh

@@ -1374,17 +1374,17 @@ _url_replace() {
 }
 
 _time2str() {
-  #Linux
-  if date -u -d@"$1" 2>/dev/null; then
+  #BSD
+  if date -u -r "$1" 2>/dev/null; then
     return
   fi
 
-  #BSD
-  if date -u -r "$1" 2>/dev/null; then
+  #Linux
+  if date -u -d@"$1" 2>/dev/null; then
     return
   fi
 
-  #Soaris
+  #Solaris
   if _exists adb; then
     _t_s_a=$(echo "0t${1}=Y" | adb)
     echo "$_t_s_a"