How can we get system timezone setting and pass it to pytz.timezone?
We can use time.tzname get a local timezone name, but that name is not compatible with pytz.timezone.
In fact, the name returned by time.tzname is ambiguous. This method returns ('CST', 'CST') in my system, but 'CST' can indicate four timezones:
- Central Time Zone (North America) - observed in North America's Central Time Zone
- China Standard Time
- Chungyuan Standard Time - the term "Chungyuan Standard Time" is now rarely in use in Taiwan
- Australian Central Standard Time (ACST)