aboutsummaryrefslogtreecommitdiffstats
path: root/src/chsleep.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-06-26 10:54:55 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-06-26 10:54:55 +0000
commit300ecfe103d1d305e78a15196d2fa1aecfddc729 (patch)
treed4b2f54280a9fc8f6e7487f65687ad90e8ebb0e5 /src/chsleep.c
parenta108008263c8c8fe80921e549346b78462b76036 (diff)
downloadChibiOS-300ecfe103d1d305e78a15196d2fa1aecfddc729.tar.gz
ChibiOS-300ecfe103d1d305e78a15196d2fa1aecfddc729.tar.bz2
ChibiOS-300ecfe103d1d305e78a15196d2fa1aecfddc729.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@323 35acf78f-673a-0410-8e92-d51de3d6d3f4
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 */
+
/** @} */