Esempio n. 1
0
 public static void CalcTimeDiff()
 {
     SQLiteTimeDiffDAO dao = new SQLiteTimeDiffDAO();
     DateTime remoteDate = GlobalDateTime.NowRemote;
     DateTime localDate = DateTime.Now;
     double diff = (remoteDate - localDate).TotalMilliseconds;
     dao.Create (diff);
 }
 void CalcTimeDiff()
 {
     bool success = false;
     while (!success)
     {
         try
         {
             GlobalDateTime.CalcTimeDiff();
             success = true;
         }
         catch
         {
             SQLiteTimeDiffDAO dao = new SQLiteTimeDiffDAO();
             if (dao.Count == 0)
             {
                 Logger.LogInfo("ERROR ON CALC TIME DIFF", "Failed to load server time, record not found on database... attempt to try again.");
                 Thread.Sleep(2000);
             }
             else
             {
                 Logger.LogInfo("WARNING ON CALC TIME DIFF", "Failed to load server time... using previous information.");
                 success = true;
             }
         }
     }
 }