Compare commits

...

4 Commits

Author SHA1 Message Date
7a231b7686 3.0.19 2020-07-07 22:37:42 +00:00
ef6e21080e fix(core): update 2020-07-07 22:37:41 +00:00
3ea8b1564d 3.0.18 2020-05-27 18:16:12 +00:00
1b92240c4e fix(core): update 2020-05-27 18:16:11 +00:00
3 changed files with 10 additions and 11 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smarttime", "name": "@pushrocks/smarttime",
"version": "3.0.17", "version": "3.0.19",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,7 +1,7 @@
{ {
"name": "@pushrocks/smarttime", "name": "@pushrocks/smarttime",
"private": false, "private": false,
"version": "3.0.17", "version": "3.0.19",
"description": "handle time in smart ways", "description": "handle time in smart ways",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts", "typings": "dist_ts/index.d.ts",
@ -24,7 +24,6 @@
"dependencies": { "dependencies": {
"@pushrocks/smartdelay": "^2.0.9", "@pushrocks/smartdelay": "^2.0.9",
"@pushrocks/smartpromise": "^3.0.2", "@pushrocks/smartpromise": "^3.0.2",
"@types/cron": "^1.7.1",
"croner": "^1.1.23", "croner": "^1.1.23",
"dayjs": "^1.8.27", "dayjs": "^1.8.27",
"is-nan": "^1.3.0" "is-nan": "^1.3.0"

View File

@ -4,8 +4,8 @@
export class HrtMeasurement { export class HrtMeasurement {
public nanoSeconds: number = null; public nanoSeconds: number = null;
public milliSeconds: number = null; public milliSeconds: number = null;
private _hrTimeStart = null; private _milliStart: number = null;
private _hrTimeStopDiff = null; private _milliDiff: number = null;
private _started: boolean = false; private _started: boolean = false;
/** /**
@ -13,7 +13,7 @@ export class HrtMeasurement {
*/ */
public start() { public start() {
this._started = true; this._started = true;
this._hrTimeStart = process.hrtime(); this._milliStart = Date.now();
} }
/** /**
@ -24,9 +24,9 @@ export class HrtMeasurement {
console.log("Hasn't started yet"); console.log("Hasn't started yet");
return; return;
} }
this._hrTimeStopDiff = process.hrtime(this._hrTimeStart); this._milliDiff = Date.now() - this._milliStart;
this.nanoSeconds = this._hrTimeStopDiff[0] * 1e9 + this._hrTimeStopDiff[1]; this.nanoSeconds = this._milliDiff * 1000;
this.milliSeconds = this.nanoSeconds / 1000000; this.milliSeconds = this._milliDiff;
return this; return this;
} }
@ -36,8 +36,8 @@ export class HrtMeasurement {
public reset() { public reset() {
this.nanoSeconds = null; this.nanoSeconds = null;
this.milliSeconds = null; this.milliSeconds = null;
this._hrTimeStart = null; this._milliStart = null;
this._hrTimeStopDiff = null; this._milliDiff = null;
this._started = false; this._started = false;
} }
} }