Merge branch 'master' into connectionstatus-and-augment-metadata

This commit is contained in:
Ben Meadors
2023-02-03 14:27:18 -06:00
committed by GitHub
4 changed files with 39 additions and 45 deletions

View File

@@ -599,6 +599,17 @@ uint32_t sinceLastSeen(const meshtastic_NodeInfo *n)
return delta;
}
uint32_t sinceReceived(const meshtastic_MeshPacket *p)
{
uint32_t now = getTime();
int delta = (int)(now - p->rx_time);
if (delta < 0) // our clock must be slightly off still - not set from GPS yet
delta = 0;
return delta;
}
#define NUM_ONLINE_SECS (60 * 60 * 2) // 2 hrs to consider someone offline
size_t NodeDB::getNumOnlineNodes()

View File

@@ -32,6 +32,9 @@ extern meshtastic_User &owner;
/// Given a node, return how many seconds in the past (vs now) that we last heard from it
uint32_t sinceLastSeen(const meshtastic_NodeInfo *n);
/// Given a packet, return how many seconds in the past (vs now) it was received
uint32_t sinceReceived(const meshtastic_MeshPacket *p);
class NodeDB
{
// NodeNum provisionalNodeNum; // if we are trying to find a node num this is our current attempt