mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-12 23:51:25 +00:00
fix time scaling
This commit is contained in:
parent
cd4cd6fe56
commit
f5a2596acf
@ -202,11 +202,11 @@ void MeshService::handleToRadio(std::string s)
|
|||||||
if (r.variant.packet.has_payload && r.variant.packet.payload.which_variant == SubPacket_position_tag && r.variant.packet.payload.variant.position.time)
|
if (r.variant.packet.has_payload && r.variant.packet.payload.which_variant == SubPacket_position_tag && r.variant.packet.payload.variant.position.time)
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
uint32_t msecs = r.variant.packet.payload.variant.position.time;
|
uint32_t secs = r.variant.packet.payload.variant.position.time;
|
||||||
|
|
||||||
// FIXME, this is a shit not right version of the standard def of unix time!!!
|
// FIXME, this is a shit not right version of the standard def of unix time!!!
|
||||||
tv.tv_sec = msecs / 1000;
|
tv.tv_sec = secs;
|
||||||
tv.tv_usec = (msecs % 1000) * 1000; // scale only the msecs portion of the timestamp (i.e. remainder after dividing by 1s)
|
tv.tv_usec = 0;
|
||||||
|
|
||||||
gps.perhapsSetRTC(&tv);
|
gps.perhapsSetRTC(&tv);
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ void NodeDB::updateFrom(const MeshPacket &mp)
|
|||||||
if (mp.has_payload)
|
if (mp.has_payload)
|
||||||
{
|
{
|
||||||
const SubPacket &p = mp.payload;
|
const SubPacket &p = mp.payload;
|
||||||
DEBUG_MSG("Update DB node 0x%x for variant %d\n", mp.from, p.which_variant);
|
DEBUG_MSG("Update DB node 0x%x for variant %d, rx_time=%u\n", mp.from, p.which_variant, mp.rx_time);
|
||||||
|
|
||||||
int oldNumNodes = *numNodes;
|
int oldNumNodes = *numNodes;
|
||||||
NodeInfo *info = getOrCreateNode(mp.from);
|
NodeInfo *info = getOrCreateNode(mp.from);
|
||||||
|
Loading…
Reference in New Issue
Block a user