Skip to content

Commit

Permalink
fix: better timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed May 14, 2024
1 parent 67d1c70 commit 541c130
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/views/Zniffer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
:mobile-breakpoint="-1"
>
<template v-slot:[`item.timestamp`]="{ item }">
{{ new Date(item.timestamp).toLocaleString() }}
{{ getTimestamp(item.timestamp) }}
</template>

<template v-slot:[`item.channel`]="{ item }">
Expand Down Expand Up @@ -296,17 +296,17 @@ export default {
framesFiltered: [],
headers: [
{ text: 'Timestamp', value: 'timestamp', width: 160 },
{ text: 'Delta [ms]', value: 'delta' },
{
text: 'Protocol Data Rate',
value: 'protocolDataRate',
width: 175,
},
{ text: 'RSSI', value: 'rssi' },
{ text: 'Ch', value: 'channel' },
{ text: 'Delta [ms]', value: 'delta' },
{ text: 'Home Id', value: 'homeId' },
{ text: 'Src', value: 'sourceNodeId' },
{ text: 'Dest', value: 'destinationNodeId' },
{ text: 'Home Id', value: 'homeId' },
{ text: 'Type', value: 'type' },
{ text: 'Payload', value: 'payload' },
],
Expand Down Expand Up @@ -450,6 +450,12 @@ export default {
e.target.scrollTop = scrollTop
}, 10)
},
getTimestamp(timestamp) {
// format timestamp HH:mm:ss.fff
const date = new Date(timestamp)
const ms = date.getMilliseconds()
return `${date.toTimeString().split(' ')[0]}.${ms}`
},
getRegion(region) {
return (
rfRegions.find((r) => r.value === region)?.text ||
Expand All @@ -476,7 +482,7 @@ export default {
},
getRssi(item) {
if (item.rssi && !isRssiError(item.rssi)) {
return rssiToString(item.rssi)
return rssiToString(item.rssi) + ' dBm'
}
return item.rssiRaw
Expand Down

0 comments on commit 541c130

Please sign in to comment.