Skip to content

Commit

Permalink
clock: add declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaliy-art committed Feb 25, 2024
1 parent 4e49f64 commit cef917e
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tarantoolscript",
"version": "0.7.1",
"version": "0.8.0",
"author": "Vitaliy Artemov [email protected]",
"description": "TypeScript definitions for Tarantool Lua API.",
"repository": {
Expand Down
61 changes: 61 additions & 0 deletions src/builtin/clock/Clock.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/** @noSelfInFile */

import { CData } from 'builtin/box';

/**
* Get the wall clock time in seconds.
*/
export declare function time(): number;

/**
* Get the wall clock time in seconds.
*/
export declare function realtime(): number;

/**
* Get the wall clock time in nanoseconds.
*/
export declare function time64(): CData;

/**
* Get the wall clock time in nanoseconds.
*/
export declare function realtime64(): CData;

/**
* Get the monotonic time in seconds.
*/
export declare function monotonic(): number;

/**
* Get the monotonic time in nanoseconds.
*/
export declare function monotonic64(): CData;

/**
* Get the processor time in seconds.
*/
export declare function proc(): number;

/**
* Get the processor time in nanoseconds.
*/
export declare function proc64(): CData;

/**
* Get the thread time in seconds.
*/
export declare function thread(): number;

/**
* Get the thread time in nanoseconds.
*/
export declare function thread64(): CData;

/**
* Measure the time a function takes within a processor.
* @param func Function or function reference.
* @param args Whatever values are required by the function.
* @returns Table. First element – seconds of CPU time, second element – whatever the function returns.
*/
export declare function bench<T, U extends unknown[]>(func: (...args: U) => T, ...args: U): [number, T];
1 change: 0 additions & 1 deletion src/builtin/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/** @todo checks https://www.tarantool.io/en/doc/latest/reference/reference_lua/checks/ */
/** @todo clock https://www.tarantool.io/en/doc/latest/reference/reference_lua/clock/ */
/** @todo compat https://www.tarantool.io/en/doc/latest/reference/reference_lua/compat/ */
/** @todo config https://www.tarantool.io/en/doc/latest/reference/reference_lua/config/ */
/** @todo console https://www.tarantool.io/en/doc/latest/reference/reference_lua/console/ */
Expand Down
1 change: 1 addition & 0 deletions src/clock.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './builtin/clock/Clock';

0 comments on commit cef917e

Please sign in to comment.