aboutsummaryrefslogtreecommitdiffstats
path: root/src/chsleep.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/chsleep.c')
-rw-r--r--src/chsleep.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/chsleep.c b/src/chsleep.c
index 859333b79..7f9f161f1 100644
--- a/src/chsleep.c
+++ b/src/chsleep.c
@@ -39,4 +39,18 @@ void chThdSleep(systime_t time) {
}
#endif /* CH_USE_SLEEP */
+#ifdef CH_USE_SYSTEMTIME
+/**
+ * Checks if the current system time is within the specified time window.
+ * @param start the start of the time window (inclusive)
+ * @param end the end of the time window (non inclusive)
+ */
+bool_t chSysInTimeWindow(systime_t start, systime_t end) {
+
+ systime_t time = chSysGetTime();
+ return end >= start ? (time >= start) && (time < end) :
+ (time >= start) || (time < end);
+}
+#endif /* CH_USE_SYSTEMTIME */
+
/** @} */