mirror of
https://github.com/Xevion/banner.git
synced 2025-12-09 08:06:41 -06:00
Fix CentralTime init order (again)
This commit is contained in:
8
main.go
8
main.go
@@ -8,6 +8,7 @@ import (
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"time"
|
||||
_ "time/tzdata"
|
||||
|
||||
"github.com/bwmarrin/discordgo"
|
||||
"github.com/joho/godotenv"
|
||||
@@ -26,11 +27,18 @@ var (
|
||||
isDevelopment bool
|
||||
baseURL string // Base URL for all requests to the banner system
|
||||
environment string
|
||||
CentralTime *time.Location
|
||||
)
|
||||
|
||||
func init() {
|
||||
ctx = context.Background()
|
||||
|
||||
var err error
|
||||
CentralTime, err = time.LoadLocation("America/Chicago")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// Set zerolog's timestamp function to use the central timezone
|
||||
zerolog.TimestampFunc = func() time.Time {
|
||||
return time.Now().In(CentralTime)
|
||||
|
||||
8
term.go
8
term.go
@@ -4,7 +4,6 @@ import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
_ "time/tzdata"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
@@ -27,16 +26,9 @@ type Term struct {
|
||||
|
||||
var (
|
||||
SpringRange, SummerRange, FallRange YearDayRange
|
||||
CentralTime *time.Location
|
||||
)
|
||||
|
||||
func init() {
|
||||
var err error
|
||||
CentralTime, err = time.LoadLocation("America/Chicago")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
SpringRange, SummerRange, FallRange = GetYearDayRange(uint16(time.Now().Year()))
|
||||
|
||||
currentTerm, nextTerm := GetCurrentTerm(time.Now())
|
||||
|
||||
Reference in New Issue
Block a user