summaryrefslogtreecommitdiff
path: root/utils/zonetabconversion.py
diff options
context:
space:
mode:
Diffstat (limited to 'utils/zonetabconversion.py')
-rwxr-xr-xutils/zonetabconversion.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/utils/zonetabconversion.py b/utils/zonetabconversion.py
new file mode 100755
index 0000000..adb78fd
--- /dev/null
+++ b/utils/zonetabconversion.py
@@ -0,0 +1,29 @@
+#!/bin/python2.7
+
+tztable = open("tztable.h", "w")
+tztable.write("//This file was generated by the zonetabconversion.py script\n");
+tztable.write("static const char* olsonTimezones[] = {\n");
+
+zonefile = open("/usr/share/zoneinfo/zone.tab", "r")
+first = True
+for line in zonefile:
+ # print line
+ if line.startswith('#'):
+ # print "continue"
+ continue
+ else:
+ tz = line.split(None)[2]
+ print tz
+ if first:
+ first = False
+ tztable.write(" \"")
+ else:
+ tztable.write(",\n \"")
+ tztable.write(tz)
+ tztable.write("\"")
+
+tztable.write("\n};\n")
+tztable.write("\n")
+tztable.write("static const int numOlsonTimezones = sizeof olsonTimezones / sizeof *olsonTimezones;\n")
+tztable.write("\n")
+