@@ -16,6 +16,9 @@ import (
1616 "golang.org/x/text/unicode/norm"
1717)
1818
19+ // berlinLocation is cached to avoid repeated time.LoadLocation calls per request.
20+ var berlinLocation , _ = time .LoadLocation ("Europe/Berlin" )
21+
1922// TibiaDataDatetime func
2023func TibiaDataDatetime (date string ) string {
2124 //TODO: Normalization needs to happen above this layer
@@ -31,14 +34,11 @@ func TibiaDataDatetime(date string) string {
3134 // The string that should be returned is the current timestamp
3235 returnDate = time .Now ()
3336 } else {
34- // timezone use in html: CET/CEST
35- loc , _ := time .LoadLocation ("Europe/Berlin" )
36-
3737 // format used in datetime on html: Jan 02 2007, 19:20:30 CET
3838 formatting := "Jan 02 2006, 15:04:05 MST"
3939
4040 // parsing html in time with location set in loc
41- returnDate , err = time .ParseInLocation (formatting , date , loc )
41+ returnDate , err = time .ParseInLocation (formatting , date , berlinLocation )
4242
4343 // parsing html in tiem without loc
4444 //returnDate, err = time.Parse("Jan 02 2006, 15:04:05 MST", date)
0 commit comments