-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// timezone is a static list of timezones. It is incomplete as of now. | ||
// Eventually it will be autogenerated using the approach as shown | ||
// here: https://stackoverflow.com/questions/40120056/get-a-list-of-valid-time-zones-in-go | ||
package timezone | ||
|
||
const ( | ||
TimezoneAmericaChicago = "America/Chicago" | ||
TimezoneAmericaLosAngeles = "America/Los_Angeles" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// main this code was sourced from Stack Overflow here: | ||
// https://stackoverflow.com/a/40130882/1908967 | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"io/ioutil" | ||
"strings" | ||
) | ||
|
||
var zoneDirs = []string{ | ||
// Update path according to your OS | ||
"/usr/share/zoneinfo/", | ||
"/usr/share/lib/zoneinfo/", | ||
"/usr/lib/locale/TZ/", | ||
} | ||
|
||
var zoneDir string | ||
|
||
func main() { | ||
for _, zoneDir = range zoneDirs { | ||
ReadFile("") | ||
} | ||
} | ||
|
||
func ReadFile(path string) { | ||
files, _ := ioutil.ReadDir(zoneDir + path) | ||
for _, f := range files { | ||
if f.Name() != strings.ToUpper(f.Name()[:1])+f.Name()[1:] { | ||
continue | ||
} | ||
if f.IsDir() { | ||
ReadFile(path + "/" + f.Name()) | ||
} else { | ||
fmt.Println((path + "/" + f.Name())[1:]) | ||
} | ||
} | ||
} |