You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there any way to pass in a time zone location and get back the posix tz string? For example:
Africa/El_Aaiun returns <GMT>0?
I've got Go code that will do this but it requires reflection.
// getFieldString uses to get the unexported value of the extends fieldfuncgetFieldString(e*time.Location, fieldstring) string {
r:=reflect.ValueOf(e)
f:=reflect.Indirect(r).FieldByName(field)
returnf.String()
}
// ConvertFormat formats the tz string so it is readable by ESP32 devicesfuncconvertFormat(t*time.Location) string {
r:=regexp.MustCompile(`<.*?>`)
varcountintreturnr.ReplaceAllStringFunc(
getFieldString(t, "extend"),
func(mstring) string {
count++ifcount==1 {
return"<GMT>"
}
return"<DST>"
},
)
}
The text was updated successfully, but these errors were encountered:
This crate compiles the time zone data into a large table of transitions for a fixed set of years. The data doesn't include a TZ string like TZif files have.
Is there any way to pass in a time zone location and get back the posix tz string? For example:
Africa/El_Aaiun returns
<GMT>0
?I've got Go code that will do this but it requires reflection.
The text was updated successfully, but these errors were encountered: