diff options
author | ng0 <ng0@n0.is> | 2019-11-04 16:31:55 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-11-04 16:31:55 +0000 |
commit | f95696d36fd084997bff907e157624b8c7f22ce9 (patch) | |
tree | c228cbd67679bb76f0ec3cc9b2e8fd7fe5060c59 | |
parent | d9c8dc5c2b94e28d6ffa945f0b235fc1a790aa19 (diff) | |
download | www-f95696d36fd084997bff907e157624b8c7f22ce9.tar.gz www-f95696d36fd084997bff907e157624b8c7f22ce9.zip |
rssg: gnu date
-rwxr-xr-x | rssg | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -125,9 +125,17 @@ rel_to_abs_urls() { | |||
125 | 125 | ||
126 | 126 | ||
127 | date_rfc_822() { | 127 | date_rfc_822() { |
128 | if date --version >/dev/null 2>&1; then | 128 | # perl -MPOSIX -le 'print strftime "%a, %d %b %Y %H:%M:%S %z", (localtime "$1");' |
129 | date '+%a, %d %b %Y %H:%M:%S %z' \ | 129 | # x="$(echo "$1"| tr -cd '[:digit:]')0000" |
130 | "$(echo "$1"| tr -cd '[:digit:]')0000" | 130 | # awk -v a="$x" '{print strftime("%a, %d %b %Y %H:%M:%S %z", x)}' |
131 | if date --version >/dev/null 2>&1; then | ||
132 | in="$(echo "$1"| tr -cd '[:digit:]')0000" | ||
133 | year=$(echo $in | cut -c1-4) | ||
134 | month=$(echo $in | cut -c5-6) | ||
135 | day=$(echo $in | cut -c7-8) | ||
136 | hour=$(echo $in | cut -c9-10) | ||
137 | minute=$(echo $in | cut -c11-12) | ||
138 | date '+%a, %d %b %Y %H:%M:%S %z' "$(echo "$year"-"$month"-"$day" "$hour":"$minute")" | ||
131 | else | 139 | else |
132 | date -j '+%a, %d %b %Y %H:%M:%S %z' \ | 140 | date -j '+%a, %d %b %Y %H:%M:%S %z' \ |
133 | "$(echo "$1"| tr -cd '[:digit:]')0000" | 141 | "$(echo "$1"| tr -cd '[:digit:]')0000" |