Skip to content
Permalink
Browse files

Add special handling for mac os x (mojave/darwin18)

- date does not have option `--rfc-3339`
- `rand` is not available, use `jot` instead
  • Loading branch information...
lauft committed Mar 2, 2019
1 parent f05596f commit a6d97365fc0544ddf919ab2338fa05b31a640957
Showing with 14 additions and 0 deletions.
  1. +14 −0 test/timemachine
@@ -2,12 +2,26 @@

function current_date()
{
case "${OSTYPE}" in
darwin*)
date "+%Y-%m-%d"
;;
*)
date --rfc-3339=date
;;
esac
}

function random_minute()
{
case "${OSTYPE}" in
darwin*)
echo "0$( jot 1 0 59 )" | sed "s|.\+\(..\)\$|\1|g"
;;
*)
echo "0$( rand -M 60 )" | sed "s|.\+\(..\)\$|\1|g"
;;
esac
}

function default_hours()

0 comments on commit a6d9736

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.