add scripts/portable_date: wrapper around date for bsd/linux
[openwrt/staging/jow.git] / scripts / portable_date.sh
diff --git a/scripts/portable_date.sh b/scripts/portable_date.sh
new file mode 100755 (executable)
index 0000000..84a18eb
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+case $(uname) in
+       NetBSD|OpenBSD|DragonFly|FreeBSD|Darwin)
+               date -r $1 $2
+               ;;
+       *)
+               date -d @$1 $2
+esac
+
+exit $?