4 ms·
Is there a reason why the path to the timezone file is prefixed with a colon? TZ=:/etc/localtime I've set TZ sometimes without the colon and it seem to work.
by rootbear 10y ago
Is there a reason why the path to the timezone file is prefixed with a colon?
TZ=:/etc/localtime
I've set TZ sometimes without the colon and it seem to work. I did a quick online search and didn't find anything relevant.
- deleted 10y ago[deleted]
- avar 10y ago:<whatever> means "read it from the <whatever>" file. See the last part of the relevant glibc documentation: https://www.gnu.org/savannah-checkouts/gnu/libc/manual/html_node/TZ-Variable.html https://www.gnu.org/savannah-checkouts/gnu/libc/manual/html_... However the reason it works without : is that the implementation is being lazy and just ignores the : delimiter and falls back to parsing out a filename either way: https://sourceware.org/git/?p=glibc.git;a=blob;f=time/tzset.c;hb=refs/heads/master#l418 https://sourceware.org/git/?p=glibc.git;a=blob;f=time/tzset....
- rootbear 10y agoYou beat me to it. I was answering my own question when one of my users came in with a problem. Stupid users...
- rootbear 10y agoHere is the answer: https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html https://www.gnu.org/software/libc/manual/html_node/TZ-Variab... The third format looks like this: :characters Each operating system interprets this format differently; in the GNU C Library, characters is the name of a file which describes the time zone. The other formats specify the timezone directly, such as EST+5EDT. Interestingly, it seems to work okay without the colon. Perhaps the leading slash implies a filename?
- deleted 10y ago[deleted]
- unwind 10y agoSee https://news.ycombinator.com/item?id=13704054 https://news.ycombinator.com/item?id=13704054. The colon forces the file to be loaded, without it the other formats are tried first.