diff options
Diffstat (limited to 'plugins/Alarms/time_utils.cpp')
-rw-r--r-- | plugins/Alarms/time_utils.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/plugins/Alarms/time_utils.cpp b/plugins/Alarms/time_utils.cpp new file mode 100644 index 0000000000..69f45612f8 --- /dev/null +++ b/plugins/Alarms/time_utils.cpp @@ -0,0 +1,25 @@ +#include "common.h"
+#include "time_utils.h"
+
+SYSTEMTIME last_check;
+
+bool IsBetween(SYSTEMTIME &time, SYSTEMTIME &start, SYSTEMTIME &end) {
+
+ FILETIME ft_time, ft_start, ft_end;
+
+ SystemTimeToFileTime(&time, &ft_time);
+ SystemTimeToFileTime(&start, &ft_start);
+ SystemTimeToFileTime(&end, &ft_end);
+
+ return (CompareFileTime(&ft_time, &ft_start) > 0 && CompareFileTime(&ft_time, &ft_end) <= 0);
+}
+
+bool IsBefore(SYSTEMTIME &time, SYSTEMTIME &start) {
+ FILETIME ft_time, ft_start;
+
+ SystemTimeToFileTime(&time, &ft_time);
+ SystemTimeToFileTime(&start, &ft_start);
+
+ return (CompareFileTime(&ft_time, &ft_start) < 0);
+}
+
|