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 0.4.2 to 0.4.6

13

package.json
{
"name": "node-opcua-date-time",
"main": "./src/date_time.js",
"version": "0.4.2",
"version": "0.4.6",
"description": "pure nodejs OPCUA SDK - module -date-time",

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

"long": "^4.0.0",
"node-opcua-assert": "^0.4.0",
"node-opcua-assert": "^0.4.6",
"underscore": "^1.9.1"

@@ -17,5 +17,5 @@ },

"bignumber.js": "^7.2.1",
"node-opcua-benchmarker": "^0.4.2",
"node-opcua-binary-stream": "^0.4.2",
"should": "13.2.1"
"node-opcua-benchmarker": "^0.4.6",
"node-opcua-binary-stream": "^0.4.6",
"should": "13.2.3"
},

@@ -36,3 +36,4 @@ "author": "Etienne Rossignon",

],
"homepage": "http://node-opcua.github.io/"
"homepage": "http://node-opcua.github.io/",
"gitHead": "537d2a1f4d88271c57389d8ed56d787cf67588d2"
}

@@ -162,3 +162,2 @@ "use strict";

const t = date.getTime(); // number of milliseconds since 1/1/70
const bn_value = new BigNumber(t).plus(offset).times(factor);

@@ -185,6 +184,30 @@ const high = bn_value.div(0x100000000);

const date = new Date(2014, 0, 1);
const hundred_nano1 = bn_dateToHundredNanoSecondFrom1601_big_number(date);
const hundred_nano2 = date_time.bn_dateToHundredNanoSecondFrom1601(date);
hundred_nano1.should.eql(hundred_nano2);
for (let h=0; h< 24; h++) {
let date = new Date(2014, 0, 1, h, 0, 0);
const hundred_nano1 = bn_dateToHundredNanoSecondFrom1601_big_number(date);
const hundred_nano2 = date_time.bn_dateToHundredNanoSecondFrom1601(date);
// note: hundred_nano1 cannot be compared to hundred_nano2 for equality as
// conversion use different number sizes
// however we can test that conversion is idempotent in all cases.
const verif1 = bn_hundredNanoSecondFrom1601ToDate_big_number(hundred_nano1[0],hundred_nano1[1]);
const hundred_nano1Verif = bn_dateToHundredNanoSecondFrom1601_big_number(verif1);
const verif2 = date_time.bn_hundredNanoSecondFrom1601ToDate(hundred_nano2[0],hundred_nano2[1]);
const hundred_nano2Verif = date_time.bn_dateToHundredNanoSecondFrom1601(verif2);
//console.log(hundred_nano1,hundred_nano2,hundred_nano2Verif, verif2.toISOString());
hundred_nano1Verif.should.eql(hundred_nano1);
hundred_nano2Verif.should.eql(hundred_nano2);
verif1.toISOString().should.eql(date.toISOString());
verif2.toISOString().should.eql(date.toISOString());
}
});

@@ -191,0 +214,0 @@

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