Skip to main content
Deno 2 is finally here ๐ŸŽ‰๏ธ
Learn more
Module

x/denops_std/function/mod.ts>reltime

๐Ÿ“š Standard module for denops.vim
Go to Latest
function reltime
import { reltime } from "https://deno.land/x/denops_std@v5.0.2/function/mod.ts";

Return an item that represents a time value. The item is a list with items that depend on the system. In Vim 9 script the type list can be used. The item can be passed to reltimestr() to convert it to a string or reltimefloat() to convert to a Float. For example, to see the time spent in function Work():

var startTime = reltime()
Work()
echo startTime->reltime()->reltimestr()

Without an argument reltime() returns the current time (the representation is system-dependent, it can not be used as the wall-clock time, see localtime() for that). With one argument is returns the time passed since the time specified in the argument. With two arguments it returns the time passed between {start} and {end}.

The {start} and {end} arguments must be values returned by reltime(). If there is an error an empty List is returned in legacy script, in Vim9 script an error is given.

Can also be used as a method:

GetStart()->reltime()

only available when compiled with the +reltime feature

Parameters

denops: Denops
start: unknown
end: unknown

Returns

Promise<unknown[]>