summaryrefslogtreecommitdiff
path: root/plugins/Alarms/src/time_utils.cpp
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-07-04 08:02:51 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-07-04 08:02:51 +0000
commit0624d6b4e9b82ccfaabf7a20d00c474a09354e8d (patch)
tree3fcd9ec7f6f5c1d0cd76ce62f83169020ea5fb02 /plugins/Alarms/src/time_utils.cpp
parent5544a559d7eea6b6da2a9e512e3480a10f31714d (diff)
Alarms: changed folder structure
git-svn-id: http://svn.miranda-ng.org/main/trunk@750 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Alarms/src/time_utils.cpp')
-rw-r--r--plugins/Alarms/src/time_utils.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/plugins/Alarms/src/time_utils.cpp b/plugins/Alarms/src/time_utils.cpp
new file mode 100644
index 0000000000..69f45612f8
--- /dev/null
+++ b/plugins/Alarms/src/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);
+}
+