This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

localtime_r does not call tzset


Hi,

When using glibc syslog, we see that the timestamp of the log entries
do not reflect timezone changes.
We realized that this is because syslog calls localtime_r?and neither
of them call tzset.

Upon further searching, we saw that the?Bug 5186 raised against glibc
already discusses this.

We understand that localtime_r is not required to call tzset. But
instead of making all applications?that directly or
indirectly use?localtime_r call tzset, wouldn't a better solution be
to make localtime_r?call tzset internally ?

We have a patch that does that shown below ?:

--- glibc-2.11.2/time/tzset.c 2010-06-28 17:32:42.897700313 -0400
+++ glibc-2.11.2.new/time/tzset.c 2010-06-25 17:36:19.885133888 -0400
@@ -621,7 +621,7 @@
?? /* Update internal database according to current TZ setting.
?? ? ?POSIX.1 8.3.7.2 says that localtime_r is not required to set tzname.
?? ? ?This is a good idea since this allows at least a bit more parallelism. ?*/
- ?tzset_internal (tp == &_tmbuf && use_localtime, 1);
+ ?tzset_internal (use_localtime, 1);

?? if (__use_tzfile)
?? ? __tzfile_compute (*timer, use_localtime, &leap_correction,

Would you please let me know if this patch can be applied to glibc ?

Also, could someone please elaborate on how not calling tzset from
within localtime_r allows more parallelism. If applications?have
to call tzset before localtime_r, doesnt that affect parallelism
atleast as much as localtime_r calling tzset_internal ?

Thanks
Sankar


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]