Skip to content

Class TimeManager

A utility class for keeping track of time

Properties

startDate static

  • Static
  • Type: Date

Methods

reset() static

Resets the time

getUptime(precision) static

Get the current uptime

Parameters

  • precision - Determines how many units of time the uptime is displayed in
    • Type: number
    • Default: 2

Returns

The current uptime in a human-readable format

  • Type: string

Example

ts
TimeManager.getUptime(1);
// Result: 4 hours

TimeManager.getUptime(2);
// Result: 4 hours, 15 minutes 

TimeManager.getUptime(3);
// Result: 4 hours, 15 minutes, 56 seconds

Built by Prozilla