fix bug when comparing timestamps
authorTony Mack <tmack@cs.princeton.edu>
Wed, 11 Mar 2009 01:19:50 +0000 (01:19 +0000)
committerTony Mack <tmack@cs.princeton.edu>
Wed, 11 Mar 2009 01:19:50 +0000 (01:19 +0000)
geni/slicemgr.py

index 0a8b1e6..b3aafea 100644 (file)
@@ -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]