summaryrefslogtreecommitdiff
path: root/src/share/common
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2012-03-16 01:14:56 -0400
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>2012-03-16 01:21:54 -0400
commitdf0fa237a75d9651a441c347ec9feaf453b30ad6 (patch)
treeb0ff575d3a06a11eac3f9c9c85866ec7d9da262f /src/share/common
parent297eddbd0194745e17946d0260872aa6d00fd692 (diff)
use date somewhat more portably
Diffstat (limited to 'src/share/common')
-rw-r--r--src/share/common10
1 files changed, 10 insertions, 0 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