Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-opcua-date-time

Package Overview
Dependencies
Maintainers
1
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-opcua-date-time - npm Package Compare versions

Comparing version 2.1.0 to 2.1.3

2

dist/date_time.d.ts

@@ -28,2 +28,4 @@ export declare class DateWithPicoseconds extends Date {

export declare function getCurrentClockWithJavascriptDate(): PreciseClock;
export declare function installPeriodicClockAdjustmement(): void;
export declare function uninstallPeriodicClockAdjustmement(): void;
export declare function getCurrentClock(): PreciseClock;

@@ -30,0 +32,0 @@ export declare function coerceClock(timestamp: any, picoseconds?: number): {

@@ -134,4 +134,30 @@ "use strict";

exports.getCurrentClockWithJavascriptDate = getCurrentClockWithJavascriptDate;
const origin = process.hrtime();
const refTime = Date.now();
let origin = process.hrtime();
let refTime = Date.now();
// update refTime now and then to make sure that we don't miss
// any system time adjustment here such as a NTP clock event
// see #651
let timerId;
let timerInstallationCount = 0;
const g_setInterval = global.setInterval;
const g_clearInterval = global.clearInterval;
function installPeriodicClockAdjustmement() {
timerInstallationCount++;
if (timerId) {
return;
}
timerId = g_setInterval(() => {
origin = process.hrtime();
refTime = Date.now();
}, 30000 /* every 30 seconds */);
}
exports.installPeriodicClockAdjustmement = installPeriodicClockAdjustmement;
function uninstallPeriodicClockAdjustmement() {
timerInstallationCount--;
if (timerInstallationCount <= 0) {
g_clearInterval(timerId);
timerId = null;
}
}
exports.uninstallPeriodicClockAdjustmement = uninstallPeriodicClockAdjustmement;
const gClock = {

@@ -138,0 +164,0 @@ tick: [0, 0],

4

package.json

@@ -5,3 +5,3 @@ {

"types": "./dist/index.d.ts",
"version": "2.1.0",
"version": "2.1.3",
"description": "pure nodejs OPCUA SDK - module -date-time",

@@ -39,3 +39,3 @@ "scripts": {

"homepage": "http://node-opcua.github.io/",
"gitHead": "ddce2b6e3e13371510e63d839c1a4c4ff0be2c15"
"gitHead": "a47d959488b88d80c6d4d339d08c80ccc5490ffd"
}

@@ -154,4 +154,30 @@ /**

const origin = process.hrtime();
const refTime = Date.now();
let origin = process.hrtime();
let refTime = Date.now();
// update refTime now and then to make sure that we don't miss
// any system time adjustment here such as a NTP clock event
// see #651
let timerId: NodeJS.Timeout | null;
let timerInstallationCount = 0;
const g_setInterval = global.setInterval;
const g_clearInterval = global.clearInterval;
export function installPeriodicClockAdjustmement() {
timerInstallationCount++;
if (timerId) {
return;
}
timerId = g_setInterval(() => {
origin = process.hrtime();
refTime = Date.now();
}, 30000 /* every 30 seconds */);
}
export function uninstallPeriodicClockAdjustmement() {
timerInstallationCount--;
if (timerInstallationCount <= 0) {
g_clearInterval(timerId!);
timerId = null;
}
}
const gClock: PreciseClockEx = {

@@ -164,2 +190,3 @@ tick: [0, 0],

// make sure we get a pointer to the actual process.hrtime,

@@ -166,0 +193,0 @@ // just in case it get overridden by some library (such as sinon)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc