aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/rssg17
1 files changed, 15 insertions, 2 deletions
diff --git a/bin/rssg b/bin/rssg
index 099fe67..2d22a1a 100755
--- a/bin/rssg
+++ b/bin/rssg
@@ -2,6 +2,7 @@
#
# https://www.romanzolotarev.com/bin/rssg
# Copyright 2018 Roman Zolotarev <hi@romanzolotarev.com>
+# Copyright 2022 la-ninpre <aaoth@aaoth.xyz>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -18,6 +19,7 @@
set -e
set -x
+[ -z "$RSSG_DATE_IMPL" ] && RSSG_DATE_IMPL="GNU"
main () {
test -n "$1" || usage
@@ -118,8 +120,19 @@ rel_to_abs_urls() {
date_rfc_822() {
- date '+%a, %d %b %Y %H:%M:%S %z' \
- "$(echo "$1"| tr -cd '[:digit:]')0000"
+ _format='+%a, %d %b %Y %H:%M:%S %z'
+ _date="$1"
+ case "$RSSG_DATE_IMPL" in
+ "BSD")
+ _date="$(echo "$1" | tr -cd '[:digit:]')0000"
+ date -j "$_format" "$_date"
+ ;;
+ "GNU")
+ date -d "$_date" "$_format"
+ ;;
+ *)
+ ;;
+ esac
}