Make timestamp in ms and time based detection stash

This commit is contained in:
30hours 2024-01-02 11:14:13 +00:00
parent 9ca5b380f5
commit 4d027c5969
2 changed files with 13 additions and 4 deletions

View file

@ -1,6 +1,6 @@
const http = require('http');
var nCpi = 100;
var time = 300;
var map = [];
var timestamp = [];
var delay = [];
@ -38,8 +38,17 @@ function update_data() {
try {
detection = JSON.parse(body_map);
map.push(detection);
if (map.length > nCpi) {
map.shift();
for (i = 0; i < map.length; i++)
{
console.log((ts - map[i].timestamp)/1000);
if ((ts - map[i].timestamp)/1000 > time)
{
map.shift();
}
else
{
break;
}
}
delay = [];
doppler = [];

View file

@ -331,7 +331,7 @@ int main(int argc, char **argv)
timing_name.clear();
// output CPI timestamp for updating data
std::string t0_string = std::to_string(time[0]);
std::string t0_string = std::to_string(time[0]/1000);
socket_timestamp.write_some(asio::buffer(t0_string, 100), err);
time.clear();
}