Use monotonic() time function. This method is guaranteed to not do flaky things during leap seconds or daylight savings times jumps.

pull/350/head
Christopher K. Hoadley 5 years ago
parent d6d6b83b06
commit b02ef5e6e2

@ -16,7 +16,7 @@ import sys
import random import random
from argparse import ArgumentParser, RawDescriptionHelpFormatter from argparse import ArgumentParser, RawDescriptionHelpFormatter
from concurrent.futures import ThreadPoolExecutor from concurrent.futures import ThreadPoolExecutor
from time import time from time import monotonic
import requests import requests
from colorama import Fore, Style, init from colorama import Fore, Style, init
@ -56,10 +56,10 @@ class SherlockFuturesSession(FuturesSession):
Return Value: Return Value:
Request object. Request object.
""" """
start = time() start = monotonic()
def response_time(resp, *args, **kwargs): def response_time(resp, *args, **kwargs):
elapsed_sec = time() - start elapsed_sec = monotonic() - start
resp.elapsed = round(elapsed_sec * 1000) resp.elapsed = round(elapsed_sec * 1000)
#Install hook to execute when response completes. #Install hook to execute when response completes.

Loading…
Cancel
Save