inittimezone
All checks were successful
pedestrian-simulator / build (push) Successful in 51s

This commit is contained in:
2026-01-11 18:27:07 -07:00
parent 84a4182d28
commit c3532ec051

View File

@@ -5,7 +5,9 @@ import (
"fmt"
"log"
"net/http"
"os"
"sync"
"time"
)
var (
@@ -37,8 +39,25 @@ func getOrCreateStepManager(userID string) *StepManager {
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() {
// Initialize components
initTimezone()
InitFitbit()
InitUserRegistry()
InitVoteRegistry()