From ae29e54968460ec5a159cd53d53db735734e2243 Mon Sep 17 00:00:00 2001
From: PowerUser64 <blakelysnorth@gmail.com>
Date: Fri, 29 Apr 2022 01:18:16 -0700
Subject: [PATCH] add sleep_until

---
 .config/shell/functions/sleep-until | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 .config/shell/functions/sleep-until

diff --git a/.config/shell/functions/sleep-until b/.config/shell/functions/sleep-until
new file mode 100644
index 0000000..c5d787c
--- /dev/null
+++ b/.config/shell/functions/sleep-until
@@ -0,0 +1,13 @@
+#!/bin/sh
+# Usage: sleep_until <time>
+# Ex: sleep_until 3:00 pm
+
+sleep_until() {
+   if [ -n "$1" ] && date --date="$*" > /dev/null 2>&1; then
+      echo "Sleeping until:  $(date --date="$*")"
+
+      sleep $(( $(date -f - +%s- <<< "$*"$'\nnow') 0 ))
+   else
+      echo "Please input a date"
+   fi
+}