[gnote] Switch SyncManager from sharp::DateTime to Glib::DateTime



commit b880cd329ced29c37741dfb58d41a9b193c1e1eb
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sat Jan 25 15:10:19 2020 +0200

    Switch SyncManager from sharp::DateTime to Glib::DateTime

 src/synchronization/syncmanager.cpp | 10 +++++-----
 src/synchronization/syncmanager.hpp |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/synchronization/syncmanager.cpp b/src/synchronization/syncmanager.cpp
index 52c53be9..b1fa4a4c 100644
--- a/src/synchronization/syncmanager.cpp
+++ b/src/synchronization/syncmanager.cpp
@@ -395,7 +395,7 @@ namespace sync {
     // timer to avoid interupting the user (we want to
     // make sure not to sync more often than the user's pref)
     if(m_sync_thread == NULL) {
-      Glib::TimeSpan time_since_last_check = sharp::DateTime::now() - m_last_background_check;
+      Glib::TimeSpan time_since_last_check = 
Glib::DateTime::create_now_local().difference(m_last_background_check);
       if(sharp::time_span_total_minutes(time_since_last_check) > m_autosync_timeout_pref_minutes - 1) {
         DBG_OUT("Note edited...killing autosync timer until next save or delete event");
         m_autosync_timer.cancel();
@@ -424,7 +424,7 @@ namespace sync {
       if(m_autosync_timeout_pref_minutes > 0) {
         DBG_OUT("Autosync pref changed...restarting sync timer");
         m_autosync_timeout_pref_minutes = m_autosync_timeout_pref_minutes >= 5 ? 
m_autosync_timeout_pref_minutes : 5;
-        m_last_background_check = sharp::DateTime::now();
+        m_last_background_check = Glib::DateTime::create_now_local();
         // Perform a sync no sooner than user specified
         m_current_autosync_timeout_minutes = m_autosync_timeout_pref_minutes;
         m_autosync_timer.reset(m_current_autosync_timeout_minutes * 60000);
@@ -436,7 +436,7 @@ namespace sync {
   void SyncManager::handle_note_saved_or_deleted(const NoteBase::Ptr &)
   {
     if(m_sync_thread == NULL && m_autosync_timeout_pref_minutes > 0) {
-      Glib::TimeSpan time_since_last_check(sharp::DateTime::now() - m_last_background_check);
+      Glib::TimeSpan 
time_since_last_check(Glib::DateTime::create_now_local().difference(m_last_background_check));
       Glib::TimeSpan time_until_next_check = sharp::time_span(0, m_current_autosync_timeout_minutes, 0) - 
time_since_last_check;
       if(sharp::time_span_total_minutes(time_until_next_check) < 1) {
         DBG_OUT("Note saved or deleted within a minute of next autosync...resetting sync timer");
@@ -446,7 +446,7 @@ namespace sync {
     }
     else if(m_sync_thread == NULL && m_autosync_timeout_pref_minutes > 0) {
       DBG_OUT("Note saved or deleted...restarting sync timer");
-      m_last_background_check = sharp::DateTime::now();
+      m_last_background_check = Glib::DateTime::create_now_local();
       // Perform a sync one minute after setting change
       m_current_autosync_timeout_minutes = 1;
       m_autosync_timer.reset(m_current_autosync_timeout_minutes * 60000);
@@ -456,7 +456,7 @@ namespace sync {
 
   void SyncManager::background_sync_checker()
   {
-    m_last_background_check = sharp::DateTime::now();
+    m_last_background_check = Glib::DateTime::create_now_local();
     m_current_autosync_timeout_minutes = m_autosync_timeout_pref_minutes;
     if(m_sync_thread != NULL) {
       return;
diff --git a/src/synchronization/syncmanager.hpp b/src/synchronization/syncmanager.hpp
index b1a5c12f..5175f7af 100644
--- a/src/synchronization/syncmanager.hpp
+++ b/src/synchronization/syncmanager.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2012-2014,2017-2019 Aurimas Cernius
+ * Copyright (C) 2012-2014,2017-2020 Aurimas Cernius
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -95,7 +95,7 @@ namespace sync {
     utils::InterruptableTimeout m_autosync_timer;
     int m_autosync_timeout_pref_minutes;
     int m_current_autosync_timeout_minutes;
-    sharp::DateTime m_last_background_check;
+    Glib::DateTime m_last_background_check;
   };
 
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]