Skip to content

Commit

Permalink
Merge pull request #782 from meshtastic/no-unix-epoch
Browse files Browse the repository at this point in the history
  • Loading branch information
72A12F4E authored Jul 10, 2024
2 parents ff903d5 + facd235 commit 3a248b6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Meshtastic/Helpers/MeshPackets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func nodeInfoPacket (nodeInfo: NodeInfo, channel: UInt32, context: NSManagedObje
newTelemetries.append(telemetry)
newNode.telemetries? = NSOrderedSet(array: newTelemetries)
}

newNode.firstHeard = Date(timeIntervalSince1970: TimeInterval(Int64(nodeInfo.lastHeard)))
newNode.lastHeard = Date(timeIntervalSince1970: TimeInterval(Int64(nodeInfo.lastHeard)))
newNode.snr = nodeInfo.snr
if nodeInfo.hasUser {
Expand Down
2 changes: 1 addition & 1 deletion Meshtastic/Persistence/UpdateCoreData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func upsertNodeInfoPacket (packet: MeshPacket, context: NSManagedObjectContext)
let newNode = NodeInfoEntity(context: context)
newNode.id = Int64(packet.from)
newNode.num = Int64(packet.from)
if packet.rxTime != 0 {
if packet.rxTime > 0 {
newNode.firstHeard = Date(timeIntervalSince1970: TimeInterval(Int64(packet.rxTime)))
newNode.lastHeard = Date(timeIntervalSince1970: TimeInterval(Int64(packet.rxTime)))
}
Expand Down
4 changes: 2 additions & 2 deletions Meshtastic/Views/Nodes/Helpers/NodeDetail.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ struct NodeDetail: View {
}
}

if let firstHeard = node.firstHeard {
if let firstHeard = node.firstHeard, firstHeard.timeIntervalSince1970 > 0 {
HStack {
Label {
Text("First heard")
Expand All @@ -135,7 +135,7 @@ struct NodeDetail: View {
}
}

if let lastHeard = node.lastHeard {
if let lastHeard = node.lastHeard, lastHeard.timeIntervalSince1970 > 0 {
HStack {
Label {
Text("Last heard")
Expand Down

0 comments on commit 3a248b6

Please sign in to comment.