This commit is contained in:
@@ -5,7 +5,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -37,8 +39,25 @@ func getOrCreateStepManager(userID string) *StepManager {
|
|||||||
return sm
|
return sm
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func initTimezone() {
|
||||||
|
tz := os.Getenv("TZ")
|
||||||
|
if tz != "" {
|
||||||
|
loc, err := time.LoadLocation(tz)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error loading timezone %s: %v. Using UTC.", tz, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
time.Local = loc
|
||||||
|
log.Printf("Timezone set to %s", tz)
|
||||||
|
} else {
|
||||||
|
log.Printf("TZ environment variable not set, using system default (usually UTC)")
|
||||||
|
}
|
||||||
|
log.Printf("Current system time: %s", time.Now().Format(time.RFC1123Z))
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Initialize components
|
// Initialize components
|
||||||
|
initTimezone()
|
||||||
InitFitbit()
|
InitFitbit()
|
||||||
InitUserRegistry()
|
InitUserRegistry()
|
||||||
InitVoteRegistry()
|
InitVoteRegistry()
|
||||||
|
|||||||
Reference in New Issue
Block a user