From 2a4dcc172e56e7ded8b748287ea162640b3d698e Mon Sep 17 00:00:00 2001 From: Christopher Young Date: Tue, 25 Aug 2015 15:55:41 -0400 Subject: [PATCH] Uptime status field. --- gen_gdl90.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gen_gdl90.go b/gen_gdl90.go index a9b7de4b..d84afa4a 100644 --- a/gen_gdl90.go +++ b/gen_gdl90.go @@ -56,6 +56,7 @@ type msg struct { } var MsgLog []msg +var timeStarted time.Time // Construct the CRC table. Adapted from FAA ref above. func crcInit() { @@ -310,6 +311,9 @@ func updateStatus() { if isGPSValid() { globalStatus.GPS_satellites_locked = mySituation.satellites } + + // Update Uptime. + globalStatus.Uptime = time.Since(timeStarted) } func parseInput(buf string) ([]byte, uint16) { @@ -380,6 +384,7 @@ type status struct { GPS_satellites_locked uint16 GPS_connected bool RY835AI_connected bool + Uptime time.Duration } var globalSettings settings @@ -481,6 +486,7 @@ func saveSettings() { } func main() { + timeStarted = time.Now() runtime.GOMAXPROCS(runtime.NumCPU()) // redundant with Go v1.5+ compiler MsgLog = make([]msg, 0)