2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-25 11:01:09 +00:00

Add monotic time util function

This commit is contained in:
Jarrod Johnson 2013-09-13 14:31:25 -04:00
parent 83db40da51
commit fb8d042f48

View File

@ -34,3 +34,13 @@ def securerandomnumber(min=0, max=4294967295):
number = struct.unpack("I",os.urandom(4))[0]
return number
def monotonic_time():
"""Return a monotoc time value
In scenarios like timeouts and such, monotonic timing is preferred.
"""
if (os.name == "posix"):
return os.times()[4]
else:
return time.time()
#TODO: windows?