summaryrefslogtreecommitdiffstats
path: root/src/util.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2013-01-07 18:32:15 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2013-01-07 18:32:15 +0400
commit012167478aa431136aa5e1522d38f6fc971868b5 (patch)
tree2b90063b6d5cb113407352fe675a03cad1d83cc8 /src/util.c
parent8a29ee5d72c589b47d81e32047361f90702a7cf3 (diff)
downloadrspamd-012167478aa431136aa5e1522d38f6fc971868b5.tar.gz
rspamd-012167478aa431136aa5e1522d38f6fc971868b5.zip
* Add rolling history feature saving last 200 scanned messages.
Add /history command handler in webui.
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/util.c b/src/util.c
index 707f4c449..2784e6a78 100644
--- a/src/util.c
+++ b/src/util.c
@@ -902,16 +902,17 @@ resolve_stat_filename (memory_pool_t * pool, gchar *pattern, gchar *rcpt, gchar
#ifdef HAVE_CLOCK_GETTIME
const gchar *
-calculate_check_time (struct timeval *tv, struct timespec *begin, gint resolution)
+calculate_check_time (struct timeval *tv, struct timespec *begin, gint resolution, guint32 *scan_time)
#else
const gchar *
-calculate_check_time (struct timeval *begin, gint resolution)
+calculate_check_time (struct timeval *begin, gint resolution, guint32 *scan_time)
#endif
{
double vdiff, diff;
static gchar res[64];
static gchar fmt[sizeof ("%.10f ms real, %.10f ms virtual")];
struct timeval tv_now;
+
if (gettimeofday (&tv_now, NULL) == -1) {
msg_warn ("gettimeofday failed: %s", strerror (errno));
}
@@ -937,6 +938,8 @@ calculate_check_time (struct timeval *begin, gint resolution)
vdiff = diff;
#endif
+ *scan_time = diff;
+
sprintf (fmt, "%%.%dfms real, %%.%dfms virtual", resolution, resolution);
snprintf (res, sizeof (res), fmt, diff, vdiff);