mirror of
https://github.com/30hours/blah2.git
synced 2024-11-08 12:25:42 +00:00
Make timestamp in ms and time based detection stash
This commit is contained in:
parent
9ca5b380f5
commit
4d027c5969
2 changed files with 13 additions and 4 deletions
|
@ -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 = [];
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue