This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Re: [PATCH] tzset did not catch changes to localtime [BZ #21060 ]
Thanks for your advice, I agree with you. I will reconsider the performance things.
------------------原始邮件------------------
发件人: <carlos@redhat.com>;
收件人:马江10100629; <libc-alpha@sourceware.org>;
日 期 :2017年11月02日 23:33
主 题 :Re: [PATCH] tzset did not catch changes to localtime [BZ #21060 ]
On 11/02/2017 02:03 AM, ma.jiang@zte.com.cn wrote:
> Hi, If users modified the local timezone file (usually
> /etc/localtime) while keep the TZ environment variable untouched,
> tzset will not recalculate tzname. This is not right. Patch attached
> should fix this problem, is it OK for trunk?
Thank you for the patch! The idea you present is interesting, but it
makes tzset() expensive when run in a loop, and several interfaces
call tzset() unconditionally to update the timezone in the event the
API call is the first in the sequence. For example mktime must call
tzset, and previously this might have been fast, but now it re-reads
the file every time. I don't think this is an acceptable solution
to the problem, but without a microbenchmark we don't know. So one
way to make your point would be to contribute a microbenchmark for
tzset or mktime, and show that the performance difference is
negligible. The other alternative is to go a layer down and stat
/etc/localtime (if that file is going to be used), and therefore
provide a quick way to avoid reloading the file if it hasn't changed.
All of this also will need a test case, which may or may not be
possible e.g. test starts in one timezone, updates the file used
(via TZ to full path of timezone), and then calls tzset, and verifies
that timezone has changed.
Lastly, this patch is a non-trivial number of lines and the copyright
status of ZTE is not yet clear. I will continue the copyright
discussion off-list with you directly.
Thank you again for your contribution.
--
Cheers,
Carlos.