Skip to main content
Module

x/denops_std/function/mod.ts>reltimestr

📚 Standard module for denops.vim
Go to Latest
function reltimestr
import { reltimestr } from "https://deno.land/x/denops_std@v6.4.0/function/mod.ts";

Return a String that represents the time value of {time}. This is the number of seconds, a dot and the number of microseconds. Example:

let start = reltime()
call MyFunction()
echo reltimestr(reltime(start))

Note that overhead for the commands will be added to the time. The accuracy depends on the system. Use reltimefloat() for the greatest accuracy which is nanoseconds on some systems. Leading spaces are used to make the string align nicely. You can use split() to remove it.

echo split(reltimestr(reltime(start)))[0]

Also see profiling. If there is an error an empty string is returned in legacy script, in Vim9 script an error is given.

Can also be used as a method:

reltime(start)->reltimestr()

only available when compiled with the +reltime feature

Parameters

denops: Denops
time: unknown

Returns

Promise<string>