From 1cd285635f8024082a130f0bc5eb7b79be7b497e Mon Sep 17 00:00:00 2001 From: Sacha Ligthert Date: Mon, 27 Feb 2023 22:02:23 +0100 Subject: [PATCH] Actually log errors. --- tp.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tp.go b/tp.go index edd4ea7..aedb6ce 100644 --- a/tp.go +++ b/tp.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "log" "time" ) @@ -80,14 +81,22 @@ func renderDay() string { } func getCurrentTime() (time.Time, int) { + // Declarations + var offset int + var loc *time.Location + var err error + // Current Time ct := time.Now() // Get the offset from whatever the system timezone is - _, offset := ct.Local().Zone() + _, offset = ct.Local().Zone() // Make sure that the time is in UTC, so the offset makes sense - loc, _ := time.LoadLocation("UTC") + loc, err = time.LoadLocation("UTC") + if err != nil { + log.Fatal(err) + } ct = ct.In(loc) // Return things