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