regebro / tzlocal

A Python module that tries to figure out what your local timezone is
MIT License
185 stars 58 forks source link

CentOS get_timezone() #19

Closed c-x closed 9 years ago

c-x commented 9 years ago

CentOS 7 has removed the file /etc/sysconfig/clock for command like timedatectl.

The function tzlocal.get_timezone() which should return for example "Europe/Paris" is in that case returning "local", which is invalid.

CentOS 6
>>> tzlocal.get_localzone()
<DstTzInfo 'Europe/Paris' LMT+0:09:00 STD>

CentOS 7 (even though timedatectl is correctly set)
>>> tzlocal.get_localzone()
<DstTzInfo 'local' PMT+0:09:00 STD>

Workaround: Create the file /etc/sysconfig/clock which contains the timezone.

Thanks

regebro commented 9 years ago

This has been fixed and will be included in the next release.