From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4523 Path: news.gmane.org!not-for-mail From: orc Newsgroups: gmane.linux.lib.musl.general Subject: Re: syslog() always sends GMT timestamps Date: Wed, 29 Jan 2014 19:45:25 +0800 Message-ID: <770108a1-99d7-4ef0-b860-b045866c9895@email.android.com> References: <500a674a-fd43-49f5-99b8-6fd0b18ef5a2@email.android.com> <20140128171153.GL24286@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1390995940 13251 80.91.229.3 (29 Jan 2014 11:45:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 29 Jan 2014 11:45:40 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4527-gllmg-musl=m.gmane.org@lists.openwall.com Wed Jan 29 12:45:49 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1W8TaU-0007GZ-Jb for gllmg-musl@plane.gmane.org; Wed, 29 Jan 2014 12:45:46 +0100 Original-Received: (qmail 21534 invoked by uid 550); 29 Jan 2014 11:45:43 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 21522 invoked from network); 29 Jan 2014 11:45:43 -0000 User-Agent: K-9 Mail for Android In-Reply-To: <20140128171153.GL24286@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:4523 Archived-At: Rich Felker пишет: >On Tue, Jan 28, 2014 at 07:39:38PM +0800, orc wrote: >> In syslog() there is a call to gmtime_r() instead of localtime_r() >> which applies timezone offset. Logs are being collected with GMT >> timestamps which is a bit misleading. > >The standard doesn't specify whether these timestamps are local or >gmt, and does not allow modifying the global state that localtime >modifies and which localtime_r is also allowed to modify. POSIX allows >localtime_r not to modify this global state, but making such an >implementation is non-trivial. And moreover, since POSIX does not >specify syslog to access the TZ variable, accessing it would make >syslog non-safe with respect to modifying TZ from other threads, which >is probably non-conforming. These are the technical reasons I made >musl's syslog use gmt. > >Aside from that, I just think it's a bad idea to put local time in the >syslog, since different processes writing to syslog might have >different timezones set, leading to confusingly interleaved timestamps >that are hard to make sense of. Others may disagree on this (it's a >policy matter rather than a technical one) but it was probably part of >my motivation too. Thank you for your detailed explanation about cross-process and cross-user issues. Since my systems are probably not going to be true multi-user interconnected and sharing resources (say, for example, sending logs to central syslog server), I want to keep "old" behavior of syslog(). Can you give advices how I can do that in more safe way? If it is not possible, what breakage can occur if I will go with localtime_r()? Thanks! > >Rich