summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Db_autobackups/src/backup.cpp10
-rw-r--r--plugins/Db_autobackups/src/options.cpp11
2 files changed, 18 insertions, 3 deletions
diff --git a/plugins/Db_autobackups/src/backup.cpp b/plugins/Db_autobackups/src/backup.cpp
index dea8d01c97..1ac63a7bab 100644
--- a/plugins/Db_autobackups/src/backup.cpp
+++ b/plugins/Db_autobackups/src/backup.cpp
@@ -324,7 +324,15 @@ VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD)
{
time_t t = time(0);
time_t diff = t - (time_t)g_plugin.getDword("LastBackupTimestamp");
- if (diff > time_t(g_plugin.period) * (g_plugin.period_type == PT_MINUTES ? 60 : (g_plugin.period_type == PT_HOURS ? (60 * 60) : (60 * 60 * 24))))
+
+ int iMultiplicator;
+ switch (g_plugin.period_type) {
+ case PT_MINUTES: iMultiplicator = 60; break;
+ case PT_HOURS: iMultiplicator = 3600; break;
+ default: iMultiplicator = 86400; break; // days
+ }
+
+ if (diff > time_t(g_plugin.period) * iMultiplicator)
BackupStart(nullptr);
}
diff --git a/plugins/Db_autobackups/src/options.cpp b/plugins/Db_autobackups/src/options.cpp
index 79aa228e57..d0688efd59 100644
--- a/plugins/Db_autobackups/src/options.cpp
+++ b/plugins/Db_autobackups/src/options.cpp
@@ -148,7 +148,7 @@ public:
m_backupOnStart.OnChange = m_backupOnExit.OnChange = m_backupPeriodic.OnChange = Callback(this, &COptionsDlg::onChange_BackupType);
m_useCloudFile.OnChange = Callback(this, &COptionsDlg::onChange_UseCloudFile);
m_useZip.OnChange = Callback(this, &COptionsDlg::onChange_UseZip);
- m_period.OnChange = Callback(this, &COptionsDlg::onChange_Period);
+ m_periodType.OnSelChanged = m_period.OnChange = Callback(this, &COptionsDlg::onChange_Period);
m_backup.OnClick = Callback(this, &COptionsDlg::onClick_Backup);
m_browseFolder.OnClick = Callback(this, &COptionsDlg::onClick_BrowseFolder);
@@ -271,7 +271,14 @@ public:
void onChange_Period(CCtrlSpin*)
{
- time_t nextBackup = time_t(g_plugin.getDword("LastBackupTimestamp")) + m_period.GetPosition() * 86400;
+ int iMultiplicator;
+ switch (m_periodType.GetCurSel()) {
+ case PT_MINUTES: iMultiplicator = 60; break;
+ case PT_HOURS: iMultiplicator = 3600; break;
+ default: iMultiplicator = 86400; break; // days
+ }
+
+ time_t nextBackup = time_t(g_plugin.getDword("LastBackupTimestamp")) + m_period.GetPosition() * iMultiplicator;
wchar_t buf[100];
TimeZone_PrintTimeStamp(nullptr, nextBackup, L"D t", buf, _countof(buf), 0);