backport stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 26 May 2011 18:24:55 +0200
changeset 7444 9bb8f89fd31c
parent 7442 aee55fb4633c (current diff)
parent 7443 c10164464afc (diff)
child 7445 5331ba22c0e0
backport stable
server/sources/datafeed.py
--- a/server/sources/datafeed.py	Thu May 26 08:57:15 2011 +0200
+++ b/server/sources/datafeed.py	Thu May 26 18:24:55 2011 +0200
@@ -124,7 +124,7 @@
     def fresh(self):
         if self.latest_retrieval is None:
             return False
-        return datetime.now() < (self.latest_retrieval + self.synchro_interval)
+        return datetime.utcnow() < (self.latest_retrieval + self.synchro_interval)
 
     def pull_data(self, session, force=False, raise_on_error=False):
         if not force and self.fresh():
@@ -156,7 +156,7 @@
             for etype, eids in byetype.iteritems():
                 session.execute('DELETE %s X WHERE X eid IN (%s)'
                                 % (etype, ','.join(eids)))
-        self.latest_retrieval = datetime.now()
+        self.latest_retrieval = datetime.utcnow()
         session.execute('SET X latest_retrieval %(date)s WHERE X eid %(x)s',
                         {'x': self.eid, 'date': self.latest_retrieval})
         return parser.stats