summaryrefslogtreecommitdiff
path: root/plugins/PluginUpdater/src/Utils.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2013-08-02 15:07:20 +0000
committerRobert Pösel <robyer@seznam.cz>2013-08-02 15:07:20 +0000
commitf43cfc59f5a300a040b19d36f090e4f4816fcbb1 (patch)
tree321638b4185b22cc3cbaac479557dfa3f6308dfd /plugins/PluginUpdater/src/Utils.cpp
parent0d29ccd59beb6b7493aaa1a14ef7f6c40b5174df (diff)
PluginUpdater: one fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@5551 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/PluginUpdater/src/Utils.cpp')
-rw-r--r--plugins/PluginUpdater/src/Utils.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp
index 2b57022b51..7d6d8c754d 100644
--- a/plugins/PluginUpdater/src/Utils.cpp
+++ b/plugins/PluginUpdater/src/Utils.cpp
@@ -376,20 +376,29 @@ void CALLBACK TimerAPCProc(LPVOID lpArg, DWORD dwTimerLowValue, DWORD dwTimerHig
DoCheck(true);
}
-void InitTimer(bool lastSuccess)
+void InitTimer(int type)
{
CancelWaitableTimer(Timer);
if (opts.bUpdateOnPeriod) {
LONG interval = PeriodToMilliseconds(opts.Period, opts.bPeriodMeasure);
- time_t now = time(NULL);
- time_t was = db_get_dw(NULL, MODNAME, "LastUpdate", 0);
+ switch (type) {
+ case 0: // default, plan next check relative to last check
+ {
+ time_t now = time(NULL);
+ time_t was = db_get_dw(NULL, MODNAME, "LastUpdate", 0);
- interval -= (now - was) * 1000;
- if (interval <= 0)
- interval = 1000; // no last update or too far in the past -> do it now
- else if (!lastSuccess)
- interval = 1000 * 60 * 60; // failed last check, check again in one hour
+ interval -= (now - was) * 1000;
+ if (interval <= 0)
+ interval = 1000; // no last update or too far in the past -> do it now
+ break;
+ }
+ case 1: // options changed, use set interval from now
+ break;
+ case 2: // failed last check, check again in two hours
+ interval = 1000 * 60 * 60 * 2;
+ break;
+ }
_int64 qwDueTime = -10000i64 * interval;