version 0.3.0
[fms.git] / include / freenet / iindexinserter.h
index edcc86b..bb0e9e7 100644 (file)
@@ -4,13 +4,16 @@
 #include "../idatabase.h"\r
 #include "../ilogger.h"\r
 #include "../option.h"\r
-#include "../datetime.h"\r
 #include "../stringfunctions.h"\r
 #include "ifreenetregistrable.h"\r
 #include "ifcpconnected.h"\r
 #include "ifcpmessagehandler.h"\r
 #include "iperiodicprocessor.h"\r
 \r
+#include <Poco/DateTime.h>\r
+#include <Poco/Timestamp.h>\r
+#include <Poco/Timespan.h>\r
+\r
 #ifdef XMEM\r
        #include <xmem.h>\r
 #endif\r
@@ -42,7 +45,7 @@ protected:
 \r
        std::vector<IDTYPE> m_inserting;                // list of ids we are inserting\r
        std::string m_messagebase;\r
-       DateTime m_lastchecked;\r
+       Poco::DateTime m_lastchecked;\r
 \r
        // these MUST be populated by child class\r
        std::string m_fcpuniquename;\r
@@ -66,11 +69,11 @@ void IIndexInserter<IDTYPE>::FCPConnected()
        // make sure variables have been initialized by the derived class\r
        if(m_fcpuniquename=="")\r
        {\r
-               m_log->WriteLog(LogFile::LOGLEVEL_FATAL,"IIndexInserter<IDTYPE>::FCPConnected fcpuniquename not initialized correctly!");\r
+               m_log->fatal("IIndexInserter<IDTYPE>::FCPConnected fcpuniquename not initialized correctly!");\r
        }\r
        if(m_fcpuniquename.find("|")!=std::string::npos)\r
        {\r
-               m_log->WriteLog(LogFile::LOGLEVEL_FATAL,"IIndexInserter<IDTYPE>::FCPConnected fcpuniquename contains | character!  This is not a valid character!");\r
+               m_log->fatal("IIndexInserter<IDTYPE>::FCPConnected fcpuniquename contains | character!  This is not a valid character!");\r
        }\r
 \r
        m_inserting.clear();\r
@@ -111,7 +114,7 @@ const bool IIndexInserter<IDTYPE>::HandleMessage(FCPMessage &message)
                        StringFunctions::Split(message["Identifier"],"|",idparts);\r
                        StringFunctions::Convert(idparts[1],id);\r
                        RemoveFromInsertList(id);\r
-                       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IIndexInserter<IDTYPE>::HandleMessage IdentifierCollision for "+m_fcpuniquename+" "+message["Identifier"]);\r
+                       m_log->debug("IIndexInserter<IDTYPE>::HandleMessage IdentifierCollision for "+m_fcpuniquename+" "+message["Identifier"]);\r
                        return true;\r
                }\r
        }\r
@@ -124,16 +127,15 @@ void IIndexInserter<IDTYPE>::InitializeIIndexInserter()
 {\r
        m_fcpuniquename="";\r
        Option::Instance()->Get("MessageBase",m_messagebase);\r
-       m_lastchecked.SetToGMTime();\r
+       m_lastchecked=Poco::Timestamp();\r
 }\r
 \r
 template <class IDTYPE>\r
 void IIndexInserter<IDTYPE>::Process()\r
 {\r
-       DateTime now;\r
-       now.SetToGMTime();\r
+       Poco::DateTime now;\r
 \r
-       if(m_lastchecked<(now-(1.0/1440.0)))\r
+       if(m_lastchecked<(now-Poco::Timespan(0,0,1,0,0)))\r
        {\r
                CheckForNeededInsert();\r
                m_lastchecked=now;\r