I'm new to Go, and I'm trying a bit to format and display some IBM TOD mainframe clock data. I want to format the data both by GMT and local time (by default - otherwise in the zone that the user specifies).
To do this, I need to get the value of the local time offset from GMT as a signed integer number of seconds.
In zoneinfo.go (which, I admit, I don't quite understand), I see
// A zone represents a single time zone such as CEST or CET. type zone struct { name string // abbreviated name, "CET" offset int // seconds east of UTC isDST bool // is this zone Daylight Savings Time? }
but this, I think, is not exported, so this code does not work:
package main import ( "time"; "fmt" ) func main() { l, _ := time.LoadLocation("Local") fmt.Printf("%v\n", l.zone.offset) }
Is there an easy way to get this information?
source share