Skip to content

Commit

Permalink
Change lightning event to provide timestamp and time (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-bs committed Jun 1, 2024
1 parent 7c8e8a2 commit 0ba7f33
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/uplink_formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
// 20240530 Added SKIP_INVALID_SIGNALS
// Added BLE signals to decoder
// 20240531 Fixed handling of arrays in decoder()
// 20240601 Change lightning event to provide timestamp and time
//
// ToDo:
// -
Expand Down Expand Up @@ -177,7 +178,10 @@ function decoder(bytes, port) {
if (bytes.length !== unixtime.BYTES) {
throw new Error('Unix time must have exactly 4 bytes');
}
return bytesToInt(bytes);
dateObj = new Date(bytesToInt(bytes) * 1000);
let time = dateObj.toISOString();
let timestamp = bytesToInt(bytes);
return { time: time, timestamp: timestamp };
};
unixtime.BYTES = 4;

Expand Down

0 comments on commit 0ba7f33

Please sign in to comment.