switch from process.hrtime() to Date.now()
This commit is contained in:
parent
521e5740e5
commit
1c4020824d
16
dist/index.js
vendored
16
dist/index.js
vendored
@ -17,7 +17,7 @@ if (process.argv.indexOf("-v") == -1 && process.env.CI) {
|
|||||||
}
|
}
|
||||||
// exports
|
// exports
|
||||||
exports.start = function (moduleNameArg = "", loaderLengthArg = "10") {
|
exports.start = function (moduleNameArg = "", loaderLengthArg = "10") {
|
||||||
startTime = process.hrtime();
|
startTime = Date.now();
|
||||||
moduleName = moduleNameArg;
|
moduleName = moduleNameArg;
|
||||||
if (doAnimation) {
|
if (doAnimation) {
|
||||||
earlyChild = childProcess.fork(path.join(__dirname, "early.child.js"), [], {
|
earlyChild = childProcess.fork(path.join(__dirname, "early.child.js"), [], {
|
||||||
@ -34,16 +34,8 @@ exports.start = function (moduleNameArg = "", loaderLengthArg = "10") {
|
|||||||
};
|
};
|
||||||
exports.stop = function () {
|
exports.stop = function () {
|
||||||
let done = q.defer();
|
let done = q.defer();
|
||||||
let endTime = function () { try {
|
let endTime = Date.now();
|
||||||
return process.hrtime(startTime);
|
let executionTime = ((endTime - startTime) / 1000).toString();
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
return [0, 0];
|
|
||||||
} }();
|
|
||||||
;
|
|
||||||
let exTimeSeconds = endTime[0];
|
|
||||||
let exTimeMilliseconds = endTime[1] / 1000000000;
|
|
||||||
let executionTime = (exTimeSeconds + exTimeMilliseconds).toString();
|
|
||||||
if (doAnimation) {
|
if (doAnimation) {
|
||||||
earlyChild.kill("SIGINT");
|
earlyChild.kill("SIGINT");
|
||||||
earlyChild.on("close", function () {
|
earlyChild.on("close", function () {
|
||||||
@ -57,4 +49,4 @@ exports.stop = function () {
|
|||||||
}
|
}
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyI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QUUsQ0FBQztJQUNuQixDQUFDO0lBQ0QsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7QUFDeEIsQ0FBQyxDQUFDIn0=
|
@ -21,7 +21,7 @@ if (process.argv.indexOf("-v") == -1 && process.env.CI) {
|
|||||||
// exports
|
// exports
|
||||||
export let start = function (moduleNameArg: string = "", loaderLengthArg: string = "10") {
|
export let start = function (moduleNameArg: string = "", loaderLengthArg: string = "10") {
|
||||||
|
|
||||||
startTime = process.hrtime();
|
startTime = Date.now();
|
||||||
|
|
||||||
moduleName = moduleNameArg;
|
moduleName = moduleNameArg;
|
||||||
if (doAnimation) {
|
if (doAnimation) {
|
||||||
@ -39,10 +39,8 @@ export let start = function (moduleNameArg: string = "", loaderLengthArg: string
|
|||||||
|
|
||||||
export let stop = function () {
|
export let stop = function () {
|
||||||
let done = q.defer();
|
let done = q.defer();
|
||||||
let endTime = function(){try{return process.hrtime(startTime)}catch(err){return [0,0]}}();;
|
let endTime = Date.now();
|
||||||
let exTimeSeconds = endTime[0];
|
let executionTime:string = ((endTime - startTime) / 1000).toString();
|
||||||
let exTimeMilliseconds = endTime[1] / 1000000000;
|
|
||||||
let executionTime:string = (exTimeSeconds + exTimeMilliseconds).toString();
|
|
||||||
if (doAnimation) {
|
if (doAnimation) {
|
||||||
earlyChild.kill("SIGINT");
|
earlyChild.kill("SIGINT");
|
||||||
earlyChild.on("close", function () {
|
earlyChild.on("close", function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user