import { ITimer } from '@sqltools/types' ; class Timer implements ITimer { private s : [ number , number ] ; private e : [ number , number ] ; constructor ( ) { this . start ( ) ; } returns { number } memberof public elapsed ( ) { if ( ! this . s ) { return - 1 ; } else if ( ! this . e ) { const end = process . hrtime ( this . s ) ; return end [ 0 ] * 1000 + end [ 1 ] / 1000000 ; } else { return this . e [ 0 ] * 1000 + this . e [ 1 ] / 1000000 ; } } public start ( ) { this . s = process . hrtime ( ) ; } public end ( ) { if ( ! this . e ) { this . e = process . hrtime ( this . s ) ; } } } export default Timer ;