New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@smarterservices/smarterclock

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smarterservices/smarterclock - npm Package Compare versions

Comparing version 1.1.1 to 2.0.0

24

index.js

@@ -15,3 +15,3 @@ var smarterClock = function (config) {

//tickrate for getting delta from ntp server
this.tickRate = config.syncDelay || 300;
this.tickRate = config.syncDelay || 10;
// set the tickRate to milliseconds.

@@ -34,2 +34,5 @@ this.tickRate = this.tickRate * 1000;

this.currentServer = this.ntpServers[this.currentIndex];
} else {
this.currentIndex = 0;
this.currentServer = this.ntpServers[this.currentIndex];
}

@@ -47,2 +50,5 @@ };

smarterClock.prototype.getTime = function () {
return ((new Date()).getTime() + this.getDrift());
};
smarterClock.prototype.getDrift = function () {
//get sum of this.delta array

@@ -55,3 +61,3 @@ var sum = this.delta.reduce(function (a, b) {

//return your time +/- the avg delta
return ((new Date()).getTime() + avg);
return avg;
};

@@ -71,2 +77,8 @@ //this function is used for a one off sync(adds one delta value to the this.delta array)

this.shiftServer();
if(this.delta.length === 0) {
setTimeout(() => {
this.getDelta()
},1000)
}
} else {

@@ -76,5 +88,11 @@ //get delta value and push into this.delta array

var tempLocalTime = (new Date()).getTime();
if (this.delta.length === this.limit) {
if(tempServerTime <= 0) {
this.getDelta()
return;
}
if (this.delta.length >= this.limit) {
this.delta.shift();
}
this.delta.push(tempServerTime - tempLocalTime);

@@ -81,0 +99,0 @@ //if callback passed in return current delta time

2

package.json
{
"name": "@smarterservices/smarterclock",
"version": "1.1.1",
"version": "2.0.0",
"description": "store of delta values between ntp time and local time to get an accurate sync time",

@@ -5,0 +5,0 @@ "main": "index.js",

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