@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
20 lines • 782 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.date2string = date2string;
exports.printAsMs = printAsMs;
/**
* Retrieve a string in the form of "YYYY-MM-DD-HH-MM-SS-MS" from a Date object.
*
* @param date - The date to convert, defaults to the current date
*/
function date2string(date = new Date()) {
return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}-${date.getHours()}-${date.getMinutes()}-${date.getSeconds()}-${date.getMilliseconds()}`;
}
/**
* Print a number of milliseconds in a human-readable format including correct spacing.
*/
function printAsMs(ms, precision = 2) {
/* eslint-disable-next-line no-irregular-whitespace*/
return `${ms.toFixed(precision)} ms`;
}
//# sourceMappingURL=time.js.map