summaryrefslogtreecommitdiff
path: root/src/share
diff options
context:
space:
mode:
Diffstat (limited to 'src/share')
-rw-r--r--src/share/common10
-rw-r--r--src/share/mh/set_expire2
2 files changed, 11 insertions, 1 deletions
diff --git a/src/share/common b/src/share/common
index baf4270..87cef61 100644
--- a/src/share/common
+++ b/src/share/common
@@ -231,6 +231,16 @@ advance_date() {
fi
}
+print_date_from_seconds_since_the_epoch() {
+ local seconds="$1"
+ local gnutry
+
+ if ! date '+%F %T' -d @"${seconds}" 2>/dev/null ; then
+ # try it the BSD date way:
+ date -r "${seconds}" '+%F %T'
+ fi
+}
+
# check that characters are in a string (in an AND fashion).
# used for checking key capability
diff --git a/src/share/mh/set_expire b/src/share/mh/set_expire
index f9a5507..371cd76 100644
--- a/src/share/mh/set_expire
+++ b/src/share/mh/set_expire
@@ -64,7 +64,7 @@ if [ 0 == "$extendBy" ] ; then
log info "Key ${keyID} no longer expires."
else
if expiry=$(gpg_host_list_keys "${keyID}" | grep ^pub: | head -n1 | cut -f7 -d: ) ; then
- log info "Key ${keyID} now expires at $(date '+%F %T' --date "1970-01-01 0:00 UTC + ${expiry} seconds")"
+ log info "Key ${keyID} now expires at $(print_date_from_seconds_since_the_epoch ${expiry})"
else
log error "Failed to retrieve new expiration date for key ${keyID}"
fi