microtime.wasm

0.1.0 • Public • Published

microtime.wasm

Current Version Build Status via Travis CI Dependencies belly-button-style

WebAssembly implementation of the microtime module.

Note, this module is a proof of concept and likely should not be used. Emscripten implements the C function gettimeofday(2) as a call to JavaScript's Date.now(). This defeats the original purpose of microtime, which was to obtain better than the millisecond accuracy provided by Date.now().

Basic Usage

'use strict';
const { now, nowDouble, nowStruct } = require('microtime.wasm');
 
console.log(now());
console.log(nowDouble());
console.log(nowStruct());

API

microtime.wasm exports the following methods.

now()

  • Arguments
    • None.
  • Returns
    • result (number) - The current time in microseconds as an integer.

nowDouble()

  • Arguments
    • None.
  • Returns
    • result (number) - The current time in seconds as a floating point number.

nowStruct()

  • Arguments
    • None.
  • Returns
    • result (array) - The current time as a two element array. The first element represents the number of seconds. The second element represents the number of microseconds. This matches the return value of gettimeofday(2).

Readme

Keywords

Package Sidebar

Install

npm i microtime.wasm

Weekly Downloads

2

Version

0.1.0

License

MIT

Unpacked Size

79.6 kB

Total Files

6

Last publish

Collaborators

  • cjihrig