fix: Correctly calculate time since turtle was last seen in dashboard display
This commit is contained in:
@@ -126,7 +126,11 @@ local function drawDashboard()
|
|||||||
if y >= h - 5 then break end -- Leave room for activity log
|
if y >= h - 5 then break end -- Leave room for activity log
|
||||||
|
|
||||||
local statusColor = getStatusColor(turtle)
|
local statusColor = getStatusColor(turtle)
|
||||||
local timeSince = math.floor((os.epoch("utc") - (turtle.lastSeen or 0)) / 1000)
|
local timeSince = 0
|
||||||
|
if turtle.lastSeen then
|
||||||
|
local currentTime = os.epoch("utc") or 0
|
||||||
|
timeSince = math.floor((currentTime - turtle.lastSeen) / 1000)
|
||||||
|
end
|
||||||
|
|
||||||
monitor.setCursorPos(2, y)
|
monitor.setCursorPos(2, y)
|
||||||
monitor.setTextColor(statusColor)
|
monitor.setTextColor(statusColor)
|
||||||
|
|||||||
Reference in New Issue
Block a user