]> source.dussan.org Git - rspamd.git/commitdiff
Fix log time format utility
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 6 Nov 2015 14:50:55 +0000 (14:50 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 6 Nov 2015 14:50:55 +0000 (14:50 +0000)
src/libutil/util.c
src/libutil/util.h

index d493568e04f3c3eb4d2b06718b3431b3331acfa0..85ece5b4a79b4e51d1f51eb6346fd73a504eb939 100644 (file)
@@ -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;
 }
index 68ee6babc6360df203893474e1315b1d488970f5..06240e19b84cc7cf6f2a939816f648d6c15c3696 100644 (file)
@@ -158,7 +158,7 @@ gchar * resolve_stat_filename (rspamd_mempool_t *pool,
        gchar *from);
 
 const gchar *
-rspamd_log_check_time (gdouble start_real, gdouble start_virtual, gint resolution);
+rspamd_log_check_time (gdouble start, gdouble end, gint resolution);
 
 /*
  * File locking functions