version 0.1.9
[fms.git] / src / freenet / trustlistinserter.cpp
index b22453d..5f2fbb8 100644 (file)
@@ -21,7 +21,13 @@ void TrustListInserter::CheckForNeededInsert()
 {\r
        DateTime date;\r
        date.SetToGMTime();\r
-       date.Add(0,0,-1);\r
+       int currentday=date.GetDay();\r
+       date.Add(0,0,-6);\r
+       // insert trust lists every 6 hours - if 6 hours ago was different day then set to midnight of current day to insert list today ASAP\r
+       if(currentday!=date.GetDay())\r
+       {\r
+               date.Set(date.GetYear(),date.GetMonth(),currentday);\r
+       }\r
        SQLite3DB::Recordset rs=m_db->Query("SELECT LocalIdentityID, PrivateKey FROM tblLocalIdentity WHERE PrivateKey IS NOT NULL AND PrivateKey <> '' AND PublishTrustList='true' AND InsertingTrustList='false' AND (LastInsertedTrustList<='"+date.Format("%Y-%m-%d %H:%M:%S")+"' OR LastInsertedTrustList IS NULL);");\r
 \r
        if(rs.Empty()==false)\r