summaryrefslogtreecommitdiff
path: root/lib/cmp_filetime.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:29:28 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:29:28 +0200
commit75c07011b7c4d06acd7b45dabdcd60ab9d80f385 (patch)
tree8853c3978dd152ef377e652239448b1352320206 /lib/cmp_filetime.h
parent5.22 (diff)
downloadFreeFileSync-75c07011b7c4d06acd7b45dabdcd60ab9d80f385.tar.gz
FreeFileSync-75c07011b7c4d06acd7b45dabdcd60ab9d80f385.tar.bz2
FreeFileSync-75c07011b7c4d06acd7b45dabdcd60ab9d80f385.zip
5.23
Diffstat (limited to 'lib/cmp_filetime.h')
-rw-r--r--lib/cmp_filetime.h57
1 files changed, 0 insertions, 57 deletions
diff --git a/lib/cmp_filetime.h b/lib/cmp_filetime.h
deleted file mode 100644
index 4e75675b..00000000
--- a/lib/cmp_filetime.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef CMP_FILETIME_H_INCLUDED
-#define CMP_FILETIME_H_INCLUDED
-
-#include <wx/stopwatch.h>
-#include <zen/int64.h>
-
-namespace zen
-{
-//---------------------------------------------------------------------------------------------------------------
-inline
-bool sameFileTime(const Int64& a, const Int64& b, size_t tolerance)
-{
- if (a < b)
- return b <= a + static_cast<ptrdiff_t>(tolerance);
- else
- return a <= b + static_cast<ptrdiff_t>(tolerance);
-}
-//---------------------------------------------------------------------------------------------------------------
-
-//number of seconds since Jan 1st 1970 + 1 year (needn't be too precise)
-static const long oneYearFromNow = wxGetUTCTime() + 365 * 24 * 3600; //init at program startup alas in *each* compilation untit -> avoid MT issues
-//refactor when C++11 thread-safe static initialization is availalbe in VS (already in GCC)
-
-class CmpFileTime
-{
-public:
- enum Result
- {
- TIME_EQUAL,
- TIME_LEFT_NEWER,
- TIME_RIGHT_NEWER,
- TIME_LEFT_INVALID,
- TIME_RIGHT_INVALID
- };
-
- static Result getResult(const Int64& lhs, const Int64& rhs, size_t tolerance)
- {
- if (sameFileTime(lhs, rhs, tolerance)) //last write time may differ by up to 2 seconds (NTFS vs FAT32)
- return TIME_EQUAL;
-
- //check for erroneous dates
- if (lhs < 0 || lhs > oneYearFromNow) //earlier than Jan 1st 1970 or more than one year in future
- return TIME_LEFT_INVALID;
-
- if (rhs < 0 || rhs > oneYearFromNow)
- return TIME_RIGHT_INVALID;
-
- //regular time comparison
- if (lhs < rhs)
- return TIME_RIGHT_NEWER;
- else
- return TIME_LEFT_NEWER;
- }
-};
-}
-
-#endif // CMP_FILETIME_H_INCLUDED
bgstack15