aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2016-01-31 23:28:55 +0000
committerFelix Fietkau <nbd@openwrt.org>2016-01-31 23:28:55 +0000
commit2f14514a12f708fecbe786e028fb9e3c542907da (patch)
tree53bf82ff9144ec1cb06112ab154a65aca98a8c3f /scripts
parent7695d614df8c4877c081de737e56eee8cacddbd8 (diff)
downloadupstream-2f14514a12f708fecbe786e028fb9e3c542907da.tar.gz
upstream-2f14514a12f708fecbe786e028fb9e3c542907da.tar.bz2
upstream-2f14514a12f708fecbe786e028fb9e3c542907da.zip
add scripts/portable_date: wrapper around date for bsd/linux
date -r $unix_timestamp on bsd is equal to date -d @$unix_timestamp on linux. To support reproducible builds and not loosing every timestamp it's required to convert a unix timestamp into human readable timestamp ./scripts/portable_date $unix_timstamp +%T Signed-off-by: Alexander Couzens <lynxis@fe80.eu> SVN-Revision: 48583
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/portable_date.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/portable_date.sh b/scripts/portable_date.sh
new file mode 100755
index 0000000000..84a18eb621
--- /dev/null
+++ b/scripts/portable_date.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+case $(uname) in
+ NetBSD|OpenBSD|DragonFly|FreeBSD|Darwin)
+ date -r $1 $2
+ ;;
+ *)
+ date -d @$1 $2
+esac
+
+exit $?