You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

time.go 671B

12345678910111213141516171819202122232425262728
  1. // Copyright 2023 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package setting
  4. import (
  5. "time"
  6. "code.gitea.io/gitea/modules/log"
  7. )
  8. // DefaultUILocation is the location on the UI, so that we can display the time on UI.
  9. var DefaultUILocation = time.Local
  10. func loadTimeFrom(rootCfg ConfigProvider) {
  11. zone := rootCfg.Section("time").Key("DEFAULT_UI_LOCATION").String()
  12. if zone != "" {
  13. var err error
  14. DefaultUILocation, err = time.LoadLocation(zone)
  15. if err != nil {
  16. log.Fatal("Load time zone failed: %v", err)
  17. }
  18. log.Info("Default UI Location is %v", zone)
  19. }
  20. if DefaultUILocation == nil {
  21. DefaultUILocation = time.Local
  22. }
  23. }