diff --git a/lib/protocol/Writer.js b/lib/protocol/Writer.js index 28cf501..fd26013 100644 --- a/lib/protocol/Writer.js +++ b/lib/protocol/Writer.js @@ -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); } else { throw createInputError('LONGDATE'); } @@ -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;