int CSyncThread::getLastPollInterval() { uint64 nowTime = CLocalTime().toULong(); uint64 latestTimeUpdated = 0; Vector<String> arPartNames = db::CDBAdapter::getDBAllPartitionNames(); for( int i = 0; i < (int)arPartNames.size(); i++ ) { db::CDBAdapter& dbPart = db::CDBAdapter::getDB(arPartNames.elementAt(i).c_str()); IDBResult res = dbPart.executeSQL("SELECT last_updated from sources"); for ( ; !res.isEnd(); res.next() ) { uint64 timeUpdated = res.getUInt64ByIdx(0); if ( latestTimeUpdated < timeUpdated ) latestTimeUpdated = timeUpdated; } } return latestTimeUpdated > 0 ? (int)(nowTime-latestTimeUpdated) : 0; }