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.2.1 to 0.2.2

test/test_date_to_64bits_conversion.js

4

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

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

"node-opcua-benchmarker": "^0.2.0",
"node-opcua-binary-stream": "^0.2.1",
"node-opcua-binary-stream": "^0.2.2",
"should": "13.2.1"

@@ -19,0 +19,0 @@ },

@@ -73,6 +73,11 @@ "use strict";

//
/**
*
* @param date {Date}
* @returns {[high,low]}
*/
function bn_dateToHundredNanoSecondFrom1601_fast(date) {
assert(date instanceof Date);
if (date.high_low) {
return date.high_low;
return date.high_low;
}

@@ -110,7 +115,3 @@

var high_low = [value_h, value_l];
Object.defineProperty(date, "high_low", {
get: function () {
return high_low;
}, enumerable: false
});
date.high_low = high_low;
return high_low;

@@ -133,8 +134,11 @@ }

var date = new Date(value1);
// enrich the date
Object.defineProperty(date, "high_low", {
get: function () {
return [high, low];
}, enumerable: false
});
date.high_low = [high,low];
//xxObject.defineProperty(date, "high_low", {
//xx get: function () {
//xx return [high, low];
//xx }, enumerable: false
//xx});
return date;

@@ -141,0 +145,0 @@ }

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

};
const MAXUINT32 = 4294967295; // 2**32 - 1
exports.encodeDateTime = function (date, stream) {

@@ -52,2 +53,11 @@

var lo = hl[1];
// make sure that date are not lower than expected limit
if (hi<0 || lo<0) {
hi=0;lo=0;
}
if (hi <0 || lo<0 || hi > MAXUINT32 || lo > MAXUINT32 ) {
var hl = bn_dateToHundredNanoSecondFrom1601(date);
throw new Error("INVALID " + hi + " "+lo + " "+date.toUTCString());
}
stream.writeUInt32(lo);

@@ -66,4 +76,7 @@ stream.writeUInt32(hi);

function coerceDateTime(value) {
if (value instanceof Date) {
return value;
}
return new Date(value);
}
exports.coerceDateTime = coerceDateTime;

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