static void f_range(typval_T *argvars, typval_T *rettv);
static void f_readfile(typval_T *argvars, typval_T *rettv);
static void f_reltime(typval_T *argvars, typval_T *rettv);
+#ifdef FEAT_FLOAT
+static void f_reltimefloat(typval_T *argvars, typval_T *rettv);
+#endif
static void f_reltimestr(typval_T *argvars, typval_T *rettv);
static void f_remote_expr(typval_T *argvars, typval_T *rettv);
static void f_remote_foreground(typval_T *argvars, typval_T *rettv);
{"range", 1, 3, f_range},
{"readfile", 1, 3, f_readfile},
{"reltime", 0, 2, f_reltime},
+ {"reltimefloat", 1, 1, f_reltimefloat},
{"reltimestr", 1, 1, f_reltimestr},
{"remote_expr", 2, 3, f_remote_expr},
{"remote_foreground", 1, 1, f_remote_foreground},
#endif
}
+#ifdef FEAT_FLOAT
+/*
+ * "reltimefloat()" function
+ */
+ static void
+f_reltimefloat(typval_T *argvars UNUSED, typval_T *rettv)
+{
+# ifdef FEAT_RELTIME
+ proftime_T tm;
+# endif
+
+ rettv->v_type = VAR_FLOAT;
+ rettv->vval.v_float = 0;
+# ifdef FEAT_RELTIME
+ if (list2proftime(&argvars[0], &tm) == OK)
+ rettv->vval.v_float = profile_float(&tm);
+# endif
+}
+#endif
+
/*
* "reltimestr()" function
*/
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".
*/
void profile_end(proftime_T *tm);
void profile_sub(proftime_T *tm, proftime_T *tm2);
char *profile_msg(proftime_T *tm);
+float_T profile_float(proftime_T *tm);
void profile_setlimit(long msec, proftime_T *tm);
int profile_passed_limit(proftime_T *tm);
void profile_zero(proftime_T *tm);