summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds2.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-02-07 21:19:28 +0100
committerBram Moolenaar <Bram@vim.org>2016-02-07 21:19:28 +0100
commit79c2c881bb7ae1cbdeeff91d4875b4bf2e54df06 (patch)
tree9af61874e83f9428b0b91e54328e3f92f7ed9f95 /src/ex_cmds2.c
parentdc94a26a641914df5f1ba1ab47a5752e1137287e (diff)
patch 7.4.1285v7.4.1285
Problem: Cannot measure elapsed time. Solution: Add reltimefloat().
Diffstat (limited to 'src/ex_cmds2.c')
-rw-r--r--src/ex_cmds2.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 98b8c8fbb5..49e4d3df44 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -1010,6 +1010,24 @@ profile_msg(proftime_T *tm)
return buf;
}
+# if defined(FEAT_FLOAT) || defined(PROTO)
+/*
+ * Return a float that represents the time in "tm".
+ */
+ float_T
+profile_float(proftime_T *tm)
+{
+# ifdef WIN3264
+ LARGE_INTEGER fr;
+
+ QueryPerformanceFrequency(&fr);
+ return (float_T)tm->QuadPart / (float_T)fr.QuadPart;
+# else
+ return (float_T)tm->tv_sec + (float_T)tm->tv_usec / 1000000.0;
+# endif
+}
+# endif
+
/*
* Put the time "msec" past now in "tm".
*/