Files
Myrient-Search-Engine/lib/time.js
Alexandra 3e6f6eeb36 * reimplement searchalikes
* separate kws based on categories
* auto include kws based on field options
* add roman numeral parse
* add number to name
* split out json search alikes to be per category
* add new kws columns to Files
* add search sample for determining if a game is in a series (maybe this could be useful somewhere else, too)
2025-05-18 07:11:37 -06:00

17 lines
475 B
JavaScript

export class timer {
constructor() {
this.startTime = process.hrtime();
}
parseHrtimetoSeconds(hrtime) {
var seconds = (hrtime[0] + hrtime[1] / 1e9).toFixed(3);
return seconds;
}
elapsed() {
let elapsed = this.parseHrtimetoSeconds(process.hrtime(this.startTime));
let h = Math.floor(elapsed / 3600);
let m = Math.floor(elapsed / 60);
let s = Math.floor(elapsed % 60);
return `${h ? h + "h" : ""}${m ? m + "m" : ""}${s + "s"}`;
}
}