commit f139fda08921093a10e9b3521bf7640c9223165f parent 8b0711ad307544c51b2721b7de495f0ae17ca037 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Tue, 26 Jan 2021 11:50:31 +0100 calendar-notify: accommodate differences in BSD/GNU date(1) Diffstat:
M | .local/bin/calendar-notify | | | 7 | ++++++- |
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/.local/bin/calendar-notify b/.local/bin/calendar-notify @@ -25,7 +25,12 @@ calendar -A 0 | while read -r month day time desc; do hour="0${hour}" fi min="$(printf '%s' "$time" | sed 's/[0-2]*[0-9]:\([0-5][0-9]\).*/\1/')" - t="$(date -j +%s "$(date +%Y%m)${day}${hour}${min}")" + + if [ "$(uname)" = OpenBSD ]; then + t="$(date -j +%s "$(date +%Y%m)${day}${hour}${min}")" + else + t="$(date -d "$(date +%Y-%m)-${day} ${hour}:${min}" +%s)" + fi dt="$(( $t - $t_now ))" if [ "$dt" -le "$t_notify" ] && [ "$dt" -ge 0 ]; then