Instance policy command line support
[ganeti-local] / lib / utils / __init__.py
index fd7ab70..9f7cb24 100644 (file)
@@ -32,6 +32,7 @@ import os
 import re
 import errno
 import pwd
+import time
 import itertools
 import select
 import logging
@@ -592,6 +593,13 @@ def SignalHandled(signums):
   return wrap
 
 
+def TimeoutExpired(epoch, timeout, _time_fn=time.time):
+  """Checks whether a timeout has expired.
+
+  """
+  return _time_fn() > (epoch + timeout)
+
+
 class SignalWakeupFd(object):
   try:
     # This is only supported in Python 2.5 and above (some distributions