diff --git a/bitchat/Protocols/BinaryProtocol.swift b/bitchat/Protocols/BinaryProtocol.swift index fc8013ed..e781ae01 100644 --- a/bitchat/Protocols/BinaryProtocol.swift +++ b/bitchat/Protocols/BinaryProtocol.swift @@ -196,11 +196,11 @@ extension BitchatMessage { data.append(flags) - // Timestamp - let timestampSeconds = UInt64(timestamp.timeIntervalSince1970) + // Timestamp (in milliseconds) + let timestampMillis = UInt64(timestamp.timeIntervalSince1970 * 1000) // Encode as 8 bytes, big-endian for i in (0..<8).reversed() { - data.append(UInt8((timestampSeconds >> (i * 8)) & 0xFF)) + data.append(UInt8((timestampMillis >> (i * 8)) & 0xFF)) } // ID @@ -290,11 +290,11 @@ extension BitchatMessage { return nil } let timestampData = dataCopy[offset.. 300000 { // 5 minutes in milliseconds - print("[SECURITY] Dropping packet with timestamp too far from current time: \(timeDiff/1000) seconds") + print("[SECURITY] Dropping packet from \(peerID) type:\(packet.type) - timestamp diff: \(timeDiff/1000)s (packet:\(packet.timestamp) vs current:\(currentTime))") return }