2010-09-06 16:14:57 +08:00
|
|
|
"""
|
|
|
|
|
Helper functions for benchmarking
|
|
|
|
|
"""
|
|
|
|
|
|
2011-05-17 09:52:06 +08:00
|
|
|
|
2010-09-06 16:14:57 +08:00
|
|
|
def total_seconds(delta):
|
|
|
|
|
"""
|
|
|
|
|
helper function to emulate function total_seconds,
|
|
|
|
|
introduced in python2.7
|
|
|
|
|
|
2011-12-16 00:08:30 +08:00
|
|
|
http://docs.python.org/library/datetime.html\
|
|
|
|
|
#datetime.timedelta.total_seconds
|
2010-09-06 16:14:57 +08:00
|
|
|
"""
|
|
|
|
|
|
2011-05-17 09:52:06 +08:00
|
|
|
mu_sec = 1e-6 # number of seconds in one microseconds
|
2010-09-06 16:14:57 +08:00
|
|
|
|
|
|
|
|
return delta.seconds + delta.microseconds * mu_sec
|