Use local receive time for incoming message timestamps

This commit is contained in:
DeFiDude
2026-04-05 19:45:11 -06:00
parent ed61d901ff
commit bc475bc75e
+7 -3
View File
@@ -314,10 +314,14 @@ void LXMFManager::processIncoming(const uint8_t* data, size_t len, const RNS::By
if (destHash.size() > 0) {
msg.destHash = destHash;
}
// Stamp with receiver's local time if sender's timestamp is missing/invalid
if (msg.timestamp < 1700000000) {
// Use local receive time for incoming messages so all timestamps in
// the conversation reflect THIS device's clock, not the sender's.
// Prevents confusing display when a peer's clock is wrong/unsynced.
{
time_t now = time(nullptr);
if (now > 1700000000) msg.timestamp = (double)now;
if (now > 1700000000) {
msg.timestamp = (double)now;
}
}
Serial.printf("[LXMF] Message from %s (%d bytes) content_len=%d\n",
msg.sourceHash.toHex().substr(0, 8).c_str(), (int)len, (int)msg.content.size());