Skip to content

Commit

Permalink
Merge pull request #66 from BridgeAR/master
Browse files Browse the repository at this point in the history
Add mandatory offset
  • Loading branch information
mcollina authored Mar 12, 2018
2 parents 7bf37b4 + 18235ce commit 6472f16
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/decoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,12 +382,12 @@ module.exports = function buildDecode (decodingTypes) {
switch (size) {
case 4:
// timestamp 32 stores the number of seconds that have elapsed since 1970-01-01 00:00:00 UTC in an 32-bit unsigned integer
seconds = buf.readUInt32BE()
seconds = buf.readUInt32BE(0)
break

case 8: // Timestamp 64 stores the number of seconds and nanoseconds that have elapsed
// since 1970-01-01 00:00:00 UTC in 32-bit unsigned integers, split 30/34 bits
var upper = buf.readUInt32BE()
var upper = buf.readUInt32BE(0)
var lower = buf.readUInt32BE(4)
nanoseconds = upper / 4
seconds = ((upper & 0x03) * Math.pow(2, 32)) + lower // If we use bitwise operators, we get truncated to 32bits
Expand Down

0 comments on commit 6472f16

Please sign in to comment.