Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/protocol/Writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ Writer.prototype[TypeCode.LONGDATE] = function writeLongDate(value) {
hours = ~~ts[4];
minutes = ~~ts[5];
seconds = ~~ts[6];
nanoseconds = ~~((ts[6] * 1000000000) % 1000000000);
nanoseconds = ~~((ts[6] * 10000000) % 10000000);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, one could split ts[6] by the dot and convert the parts to a number or even adapt the timestamp regexp.

} else {
throw createInputError('LONGDATE');
}
Expand All @@ -877,7 +877,7 @@ Writer.prototype[TypeCode.LONGDATE] = function writeLongDate(value) {
}
const dayDate = calendar.DAYDATE(year, month, day);
const dayFactor = BigInt(10000000) * BigInt(60 * 60 * 24);
const timeValue = BigInt(((hours * 60) + minutes) * 60 + seconds) * BigInt(10000000) + BigInt(~~(nanoseconds / 100));
const timeValue = BigInt(((hours * 60) + minutes) * 60 + seconds) * BigInt(10000000) + BigInt(nanoseconds);
const longDate = BigInt(dayDate - 1) * dayFactor + timeValue + BigInt(1);
var buffer = new Buffer(9);
buffer[0] = TypeCode.LONGDATE;
Expand Down