regebro / tzlocal

A Python module that tries to figure out what your local timezone is

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to read zoneinfo from /etc/locatime ?

Samrat-Revagade opened this issue · comments

Please help me to understand this:

Having /etc/localtime with Symlink is not supported on RHEL4, RHEL5, or RHEL6 as per Redhat's official documentation: https://access.redhat.com/solutions/7089
Also /etc/sysconfig/clock is not also a standard file to have the zoneinfo.

So, on systems where if we dont have either of above option how should we get the zoneinfo ?

The only reliable way I can imagine is to use /etc/locatime as it contains this information however it is in binary format.

Can you help with this situation ?

tzlocal will use /etc/localtime if no other way is available, so I don't understand the question.

let me try to explain this once again,
Consider a situation of RHEL- 6:
It is not standard practice to use /etc/localtime to get zoneinfo - above link says it.
now fall-back option in this case would be to read zoneinfo from - /etc/sysconfig/clock, but this also not a standard practice as systems upgrades or OS patching activities might overwrite this files and mess up with the application.

So in such situation instead of relying on files/symlink to get zoneinfo should we use a system-call which will always return the correct value no matter what ?
for exmaple : http://linux.die.net/man/2/gettimeofday ( am not sure about this .. just an example) ?
Correct me if am missing something....

There is no system call. Perhaps this would be easier if you instead of discussing in abstract terms explained what the problem is.