Created
December 30, 2020 21:48
-
-
Save InventivetalentDev/5a9311fd3b86946d22564aec045539cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Time utility class | |
*/ | |
export class Time { | |
static millis(m: number) { | |
return m; | |
} | |
/** | |
* Convert seconds to milliseconds | |
*/ | |
static seconds(s: number) { | |
return this.millis(s * 1000); | |
} | |
/** | |
* Convert minutes to milliseconds | |
*/ | |
static minutes(m: number) { | |
return this.seconds(m * 60); | |
} | |
/** | |
* Convert hours to milliseconds | |
*/ | |
static hours(h: number) { | |
return this.minutes(h * 60); | |
} | |
/** | |
* Get the current time in milliseconds | |
*/ | |
static get now(): number { | |
return Date.now(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment