summaryrefslogtreecommitdiff
path: root/RealtimeSync
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:16:21 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:16:21 +0200
commit88a2d0007db222c339f0b6a17794a2014a241892 (patch)
tree75105ef49b3a52b7ee176a1ad480e7652e49825f /RealtimeSync
parent4.2 (diff)
downloadFreeFileSync-88a2d0007db222c339f0b6a17794a2014a241892.tar.gz
FreeFileSync-88a2d0007db222c339f0b6a17794a2014a241892.tar.bz2
FreeFileSync-88a2d0007db222c339f0b6a17794a2014a241892.zip
4.3
Diffstat (limited to 'RealtimeSync')
-rw-r--r--RealtimeSync/RealtimeSync.cbp4
-rw-r--r--RealtimeSync/watcher.cpp13
2 files changed, 10 insertions, 7 deletions
diff --git a/RealtimeSync/RealtimeSync.cbp b/RealtimeSync/RealtimeSync.cbp
index c842e6bb..1f6c8049 100644
--- a/RealtimeSync/RealtimeSync.cbp
+++ b/RealtimeSync/RealtimeSync.cbp
@@ -27,7 +27,7 @@
<Add library="libwxbase28u.a" />
<Add library="libwxpng.a" />
<Add library="libwxzlib.a" />
- <Add library="libboost_thread-mgw46-mt-s-1_47.a" />
+ <Add library="libboost_thread-mgw46-mt-s-1_48.a" />
<Add directory="C:\Programme\C++\wxWidgets\lib\gcc_lib" />
</Linker>
</Target>
@@ -51,7 +51,7 @@
<Add library="libwxbase28ud.a" />
<Add library="libwxpngd.a" />
<Add library="libwxzlibd.a" />
- <Add library="libboost_thread-mgw46-mt-sd-1_47.a" />
+ <Add library="libboost_thread-mgw46-mt-sd-1_48.a" />
<Add directory="C:\Program Files\C++\wxWidgets\lib\gcc_dll" />
</Linker>
</Target>
diff --git a/RealtimeSync/watcher.cpp b/RealtimeSync/watcher.cpp
index 97ad480a..52dead7a 100644
--- a/RealtimeSync/watcher.cpp
+++ b/RealtimeSync/watcher.cpp
@@ -8,6 +8,7 @@
#include <zen/file_handling.h>
#include <zen/stl_tools.h>
#include <set>
+#include <ctime>
#include <wx/timer.h>
#include "../lib/resolve_path.h"
#include <zen/dir_watcher.h>
@@ -22,12 +23,14 @@ using namespace zen;
bool rts::updateUiIsAllowed()
{
- static wxLongLong lastExec;
- const wxLongLong newExec = wxGetLocalTimeMillis();
+ const std::clock_t CLOCK_UPDATE_INTERVAL = UI_UPDATE_INTERVAL * CLOCKS_PER_SEC / 1000;
- if (newExec - lastExec >= rts::UI_UPDATE_INTERVAL) //perform ui updates not more often than necessary
+ static std::clock_t lastExec = 0;
+ const std::clock_t now = std::clock(); //this is quite fast: 2 * 10^-5
+
+ if (now - lastExec >= CLOCK_UPDATE_INTERVAL) //perform ui updates not more often than necessary
{
- lastExec = newExec;
+ lastExec = now;
return true;
}
return false;
@@ -105,7 +108,7 @@ rts::WaitResult rts::waitForChanges(const std::vector<Zstring>& dirNamesNonFmt,
try
{
- std::vector<Zstring> changedFiles = watcher.getChanges(); //throw FileError, ErrorNotExisting
+ std::vector<Zstring> changedFiles = watcher.getChanges([&] { statusHandler->requestUiRefresh(); }); //throw FileError, ErrorNotExisting
//remove to be ignored changes
vector_remove_if(changedFiles, [](const Zstring& name)
bgstack15