diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-11-06 14:50:55 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-11-06 14:50:55 +0000 |
commit | fe927a38449754f0a5fe090c52b5552b75dd04fd (patch) | |
tree | 40af0fd4ba8b5cd340924aba4a6364e5a76943b8 /src/libutil/util.c | |
parent | a47ba1da08a16f65b3fc72f635211f5ab9529654 (diff) | |
download | rspamd-fe927a38449754f0a5fe090c52b5552b75dd04fd.tar.gz rspamd-fe927a38449754f0a5fe090c52b5552b75dd04fd.zip |
Fix log time format utility
Diffstat (limited to 'src/libutil/util.c')
-rw-r--r-- | src/libutil/util.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/libutil/util.c b/src/libutil/util.c index d493568e0..85ece5b4a 100644 --- a/src/libutil/util.c +++ b/src/libutil/util.c @@ -1161,19 +1161,16 @@ resolve_stat_filename (rspamd_mempool_t * pool, } const gchar * -rspamd_log_check_time (gdouble start_real, gdouble start_virtual, gint resolution) +rspamd_log_check_time (gdouble start, gdouble end, gint resolution) { - double vdiff, diff, end_real, end_virtual; + gdouble diff; static gchar res[64]; - static gchar fmt[sizeof ("%.10f ms real, %.10f ms virtual")]; + gchar fmt[32]; - end_real = rspamd_get_ticks (); - end_virtual = rspamd_get_virtual_ticks (); - vdiff = (end_virtual - start_virtual) * 1000; - diff = (end_real - start_real) * 1000; + diff = (end - start) * 1000.0; - sprintf (fmt, "%%.%dfms real, %%.%dfms virtual", resolution, resolution); - snprintf (res, sizeof (res), fmt, diff, vdiff); + rspamd_snprintf (fmt, sizeof (fmt), "%%.%df", resolution); + rspamd_snprintf (res, sizeof (res), fmt, diff); return (const gchar *)res; } |