From 48261edf59f03f3d1b834d9f43fd966cb9a370b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jaramago=20Fern=C3=A1ndez?= Date: Wed, 22 Dec 2021 17:28:26 +0100 Subject: [PATCH] Field 'last_updated' from 'stats_mysql_query_digest' is now reported in seconds #3734 --- lib/MySQL_Thread.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/MySQL_Thread.cpp b/lib/MySQL_Thread.cpp index 0d84ab69f..a416d06ab 100644 --- a/lib/MySQL_Thread.cpp +++ b/lib/MySQL_Thread.cpp @@ -2492,10 +2492,14 @@ char** client_host_cache_entry_row( char** row = static_cast(malloc(sizeof(char*)*CLIENT_HOST_CACHE_COLUMNS)); + time_t __now = time(NULL); + unsigned long long curtime = monotonic_time(); + time_t last_updated = __now - curtime/1000000 + entry.updated_at/1000000; + row[0]=strdup(address.c_str()); sprintf(buff, "%u", entry.error_count); row[1]=strdup(buff); - sprintf(buff, "%lu", entry.updated_at); + sprintf(buff, "%lu", last_updated); row[2]=strdup(buff); return row;