Spainnayarsystems/posix_tz_db
Generates POSIX timezones strings
POSIX Timezone Database Generator
A simple Python tool that generates POSIX timezone strings from system timezone data.
Overview
This tool reads binary timezone files from /usr/share/zoneinfo/ and extracts POSIX timezone strings, outputting them in either CSV or JSON format. It covers 469 timezone identifiers including all major regions worldwide.
Usage
# Generate CSV output
python gen-tz.py --csv
# Generate JSON output
python gen-tz.py --json
# Save to files
python gen-tz.py --csv > zones.csv
python gen-tz.py --json > zones.json
Output Format
CSV Format
"America/New_York","EST5EDT,M3.2.0,M11.1.0"
"Europe/London","GMT0BST,M3.5.0/1,M10.5.0"
"Asia/Tokyo","JST-9"
JSON Format
{
"America/New_York": "EST5EDT,M3.2.0,M11.1.0",
"Europe/London": "GMT0BST,M3.5.0/1,M10.5.0",
"Asia/Tokyo": "JST-9"
}
POSIX Timezone String Format
The POSIX strings encode timezone rules including:
- Standard time abbreviation and UTC offset
- Daylight saving time rules (if applicable)
- DST transition dates using the format
M<month>.<week>.<day>
Examples:
GMT0- Greenwich Mean Time, no DSTEST5EDT,M3.2.0,M11.1.0- Eastern Time with DST transitionsJST-9- Japan Standard Time, UTC+9, no DST
Requirements
- Python 3 (standard library only)
- System timezone data (
/usr/share/zoneinfo/) - No external dependencies
License
MIT License - See LICENSE file for details
Similar Projects
Discover other similar projects and AI models.
Complementary library for date-fns v2 adding IANA time zone support
Always up to date IANA time zones for time zone pickers: grouped list with major cities, current offsets, DST abbreviations, and the country of any time zone. Updated daily.
Kubernetes admission controller and a CLI tool to inject timezones into Pods and CronJobs