Skip to main content

Using StopWatch

Introduction

Provides a set of methods and properties that you can use to accurately measure elapsed time inside your code.

Installation

npm install @sapphire/stopwatch

Usage

// Import the Stopwatch class
const { Stopwatch } = require('@sapphire/stopwatch');

// Create a new Stopwatch (which also starts it immediately)
const stopwatch = new Stopwatch();

// run other task here

console.log(stopwatch.stop().toString());
// 200ms