Skip to content

Commit 39cb87d

Browse files
author
neil
committed
fix for DragonflyBSD
just move "date -u -j -f" before the linux branch.
1 parent e06cdbf commit 39cb87d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

acme.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,6 +1811,10 @@ _time() {
18111811
# 2022-04-01 08:10:33 to 1648800633
18121812
#or 2022-04-01T08:10:33Z to 1648800633
18131813
_date2time() {
1814+
#Mac/BSD
1815+
if date -u -j -f "%Y-%m-%d %H:%M:%S" "$(echo "$1" | tr -d "Z" | tr "T" ' ')" +"%s" 2>/dev/null; then
1816+
return
1817+
fi
18141818
#Linux
18151819
if date -u -d "$(echo "$1" | tr -d "Z" | tr "T" ' ')" +"%s" 2>/dev/null; then
18161820
return
@@ -1820,10 +1824,6 @@ _date2time() {
18201824
if gdate -u -d "$(echo "$1" | tr -d "Z" | tr "T" ' ')" +"%s" 2>/dev/null; then
18211825
return
18221826
fi
1823-
#Mac/BSD
1824-
if date -u -j -f "%Y-%m-%d %H:%M:%S" "$(echo "$1" | tr -d "Z" | tr "T" ' ')" +"%s" 2>/dev/null; then
1825-
return
1826-
fi
18271827
#Omnios
18281828
if python3 -c "import datetime; print(int(datetime.datetime.strptime(\"$1\", \"%Y-%m-%d %H:%M:%S\").replace(tzinfo=datetime.timezone.utc).timestamp()))" 2>/dev/null; then
18291829
return

0 commit comments

Comments
 (0)