Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change lightning event to provide timestamp and time #47

Merged
merged 1 commit into from
Jun 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading