1 |
Michał Górny <mgorny@g.o> writes: |
2 |
|
3 |
> On Wed, 2023-01-18 at 20:48 -0500, Joshua Kinard wrote: |
4 |
>> So this article[1] from 2017 popped up again on the tech radar via hackernews[2] and a few other sites[3]. It |
5 |
>> annotates how if the envvar TZ is undefined on a Linux system, it causes glibc to generate a number of |
6 |
>> additional syscalls, mainly stat-related calls (in my tests, newfstatat()). If defined to an actual value, |
7 |
>> such as ":/etc/localtime" (or even an empty string), glibc will instead generate far fewer, if any at all, of |
8 |
>> these stat-related syscalls. |
9 |
>> |
10 |
>> [...] |
11 |
>> So is adding a default definition of TZ to our base system /etc/profile something we want to look at? I |
12 |
>> haven't tried any other methods of benchmarking to see if not making those additional syscalls is just placebo |
13 |
>> or if there are actual impacts. Given how long this oddity has been around, I can't tell if it's a genuine |
14 |
>> bug in glibc, an unoptimized corner case, or just a big nothingburger. |
15 |
>> |
16 |
> |
17 |
> Am I correct that there's no real difference between setting it to |
18 |
> ":/etc/localtime" and the actual timezone? |
19 |
> |
20 |
> I suppose it would make sense to default it. |
21 |
|
22 |
Correct, from ``(libc)TZ Variable'': |
23 |
|
24 |
If the ‘TZ’ environment variable does not have a value, the operation |
25 |
chooses a time zone by default. In the GNU C Library, the default time |
26 |
zone is like the specification ‘TZ=:/etc/localtime’ (or |
27 |
‘TZ=:/usr/local/etc/localtime’, depending on how the GNU C Library was |
28 |
configured; *note Installation::). Other C libraries use their own rule |
29 |
for choosing the default time zone, so there is little we can say about |
30 |
them. |
31 |
|
32 |
I don't suspect any downside to this approach. |
33 |
-- |
34 |
Arsen Arsenović |