Skip to content

Commit

Permalink
feature: do not fill timestamp (#223)
Browse files Browse the repository at this point in the history
The contract of nmea0183-signalk should be to convert
source data to Signal K and only source data. If it
fills in timestamp downstream processing can not distinguish
between timestamp from source data and timestamp filled
in on the fly with current time.

Fixes #222.
  • Loading branch information
tkurki authored May 10, 2022
1 parent 1668b2e commit 5d0e26f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
4 changes: 0 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ class Parser {
tags = {}
}

if (typeof tags.timestamp === 'undefined') {
tags.timestamp = new Date().toISOString()
}

let valid = utils.valid(sentence, this.options.validateChecksum)

if (valid === false) {
Expand Down
5 changes: 2 additions & 3 deletions test/RMB.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ describe('RMB', () => {
const delta = new Parser().parse(
'$ECRMB,A,0.000,L,001,002,4653.550,N,07115.984,W,2.505,334.205,0.000,V*04'
)
delta.updates[0].timestamp.should.match(
/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]*)*Z/
)
should.equal(delta.updates[0].timestamp, undefined)

delta.updates[0].values.should.contain.an.item.with.property(
'path',
'navigation.courseRhumbline.nextPoint'
Expand Down

0 comments on commit 5d0e26f

Please sign in to comment.