The search location for the time zones is encoded in the C library (where the various time zone aware functions are found):
$ strings -a /lib/x86_64-linux-gnu/libc.so.6 | grep zoneinfo
/usr/share/zoneinfo
The C library code makes use of this directory as a preprocessor #define
, so there is no routine to ask what value it was compiled with.
If you need to parse the the time zone data yourself (as opposed to using the few C library routines available), then hard coding /usr/share/zoneinfo
should be fine: if your target platforms follow the Linux File System Hierarchy, you should be safe.
If you are only interested in the local time zone, read /etc/localtime
, which will be a copy of the relevant file from /usr/share/zoneinfo
.