2 ms·
> glibc can assume that the timezone is going to be fixed for the duration of the process's life. From what I'm seeing.. it doesn't seem to actually assume th
by akira2501 4y ago
> glibc can assume that the timezone is going to be fixed for the duration of the process's life.
From what I'm seeing.. it doesn't seem to actually assume that. It does check to see if the TZ name changed between calls and will reload a new tzfile if it has. This same mechanism is what causes the file to be loaded whenever getenv("TZ") returns NULL.
- boring_twenties 4y agoWhen I set TZ=:/etc/localtime it only stats and reads the file once. Debian 11 with glibc 2.31.
- akira2501 4y agoYes, and if you use setenv(3) to change what the value of TZ is after that point, then the new value of TZ will be observed and the new file will be loaded at that point. See 'tzset_internal' in time/tzset.c in glibc.