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