Switch to using monotonic time in Database.py timing

This commit is contained in:
jesopo 2018-08-09 10:38:13 +01:00
parent e424e3b294
commit f7e4d08eb0

View file

@ -244,13 +244,13 @@ class Database(object):
self.bot.events.on("log.debug").call( self.bot.events.on("log.debug").call(
message="executing query: \"%s\" (params: %s)", message="executing query: \"%s\" (params: %s)",
params=[printable_query, params]) params=[printable_query, params])
start = time.time() start = time.monotonic()
cursor = self.cursor() cursor = self.cursor()
cursor.execute(query, params) cursor.execute(query, params)
value = fetch_func(cursor) value = fetch_func(cursor)
end = time.time() end = time.monotonic()
total_milliseconds = (end - start) * 1000 total_milliseconds = (end - start) * 1000
self.bot.events.on("log.debug").call( self.bot.events.on("log.debug").call(
message="executed in %fms", message="executed in %fms",