node-opcua-date-time
Advanced tools
Comparing version 2.5.1 to 2.5.5
@@ -170,4 +170,10 @@ "use strict"; | ||
const hrtime = process.hrtime; | ||
const setTimeout_chek = setTimeout; | ||
/*kWithProcessHRTime*/ | ||
function getCurrentClock() { | ||
if (setTimeout_chek !== setTimeout) { | ||
// is fake sinon clock being used ? | ||
// in this case hrtime is not working | ||
return getCurrentClockWithJavascriptDate(); | ||
} | ||
gClock.tick = hrtime(origin); // [seconds, nanoseconds] | ||
@@ -174,0 +180,0 @@ const milliseconds = gClock.tick[0] * 1000 + Math.floor(gClock.tick[1] / 1000000) + refTime; |
@@ -5,3 +5,3 @@ { | ||
"types": "./dist/index.d.ts", | ||
"version": "2.5.1", | ||
"version": "2.5.5", | ||
"description": "pure nodejs OPCUA SDK - module -date-time", | ||
@@ -39,3 +39,3 @@ "scripts": { | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "4cc18f384bbdf33c5cdd2a7857e810425aa67c8b" | ||
"gitHead": "4bd588e86bb9c3772dda984526a9b4aa1f110d3f" | ||
} |
@@ -189,3 +189,2 @@ /** | ||
// make sure we get a pointer to the actual process.hrtime, | ||
@@ -195,4 +194,11 @@ // just in case it get overridden by some library (such as sinon) | ||
const setTimeout_chek = setTimeout; | ||
/*kWithProcessHRTime*/ | ||
export function getCurrentClock(): PreciseClock { | ||
if (setTimeout_chek !== setTimeout) { | ||
// is fake sinon clock being used ? | ||
// in this case hrtime is not working | ||
return getCurrentClockWithJavascriptDate(); | ||
} | ||
gClock.tick = hrtime(origin); // [seconds, nanoseconds] | ||
@@ -199,0 +205,0 @@ const milliseconds = gClock.tick[0] * 1000 + Math.floor(gClock.tick[1] / 1000000) + refTime; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35152
619