diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:19:49 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:19:49 +0200 |
commit | c8e0e909b4a8d18319fc65434a10dc446434817c (patch) | |
tree | eee91e7d2ce229dd043811eae8f1e2bd78061916 /lib/status_handler.cpp | |
parent | 5.2 (diff) | |
download | FreeFileSync-c8e0e909b4a8d18319fc65434a10dc446434817c.tar.gz FreeFileSync-c8e0e909b4a8d18319fc65434a10dc446434817c.tar.bz2 FreeFileSync-c8e0e909b4a8d18319fc65434a10dc446434817c.zip |
5.3
Diffstat (limited to 'lib/status_handler.cpp')
-rw-r--r-- | lib/status_handler.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/status_handler.cpp b/lib/status_handler.cpp index 5e75b60e..d9655c48 100644 --- a/lib/status_handler.cpp +++ b/lib/status_handler.cpp @@ -6,9 +6,12 @@ #include "status_handler.h" #include <wx/app.h> -#include <ctime> +#include <zen/tick_count.h> -void updateUiNow() +using namespace zen; + + +void zen::updateUiNow() { //process UI events and prevent application from "not responding" -> NO performance issue! wxTheApp->Yield(); @@ -17,15 +20,16 @@ void updateUiNow() // wxTheApp->Dispatch(); } - -bool updateUiIsAllowed() +namespace { - const std::clock_t CLOCK_UPDATE_INTERVAL = UI_UPDATE_INTERVAL * CLOCKS_PER_SEC / 1000; +const std::int64_t TICKS_UPDATE_INTERVAL = UI_UPDATE_INTERVAL* ticksPerSec() / 1000; +TickVal lastExec = getTicks(); +}; - 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 +bool zen::updateUiIsAllowed() +{ + const TickVal now = getTicks(); //0 on error + if (now - lastExec >= TICKS_UPDATE_INTERVAL) //perform ui updates not more often than necessary { lastExec = now; return true; |