From: Tony Mack Date: Wed, 11 Mar 2009 01:19:50 +0000 (+0000) Subject: fix bug when comparing timestamps X-Git-Tag: sfa-0.9-0@14641~592 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=e020733c48fe36df351ad04f1ea8f697769c2ef4;p=sfa.git fix bug when comparing timestamps --- diff --git a/geni/slicemgr.py b/geni/slicemgr.py index 0a8b1e68..b3aafea4 100644 --- a/geni/slicemgr.py +++ b/geni/slicemgr.py @@ -247,9 +247,13 @@ class SliceMgr(GeniServer): Return a list of components managed by this slice manager. """ # Reload components list - now = datetime.datetime.now() - if not self.nodes.has_key('threshold') or not self.nodes['threshold'] or not self.nodes.has_key('timestamp') or not self.nodes['timestamp'] or now > self.nodes['threshold']: + if not self.nodes.has_key('threshold') or not self.nodes['threshold'] or not self.nodes.has_key('timestamp') or not self.nodes['timestamp']: self.refresh_components() + else: + now = datetime.datetime.now() + threshold = datetime.datetime.fromtimestamp(time.mktime(time.strptime(self.nodes['threshold'], self.time_format))) + if now > threshold: + self.refresh_components() return self.nodes[format]