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
{{ message }}
Repository navigation
Commit dfc6ef6
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+34-1Lines changed: 34 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,40 @@ fmt.Printf("Actual IANA name: %v\n", tzname) // Prints "Actual IANA name: Europe
33
33
go get github.com/thlib/go-timezone-local/tzlocal
34
34
```
35
35
36
-
### See it in action:
36
+
### Included example
37
+
38
+
A runnable example is available in [`example/main.go`](./example/main.go). It prints the operating system, detected IANA time zone, and current local time.
39
+
40
+
The example imports [`time/tzdata`](https://pkg.go.dev/time/tzdata), so the IANA time zone database is embedded in the executable. This is useful for standalone Windows builds where a time zone database may not otherwise be available.
41
+
42
+
Run it from the repository root:
43
+
44
+
```sh
45
+
go run ./example
46
+
```
47
+
48
+
Build and run it on Linux:
49
+
50
+
```sh
51
+
go build -o bin/timezone-example-linux ./example
52
+
./bin/timezone-example-linux
53
+
```
54
+
55
+
Cross-compile it for 64-bit Windows:
56
+
57
+
```sh
58
+
GOOS=windows GOARCH=amd64 go build -o bin/timezone-example-windows-amd64.exe ./example
0 commit comments