From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4522 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: syslog() always sends GMT timestamps Date: Tue, 28 Jan 2014 12:11:53 -0500 Message-ID: <20140128171153.GL24286@brightrain.aerifal.cx> References: <500a674a-fd43-49f5-99b8-6fd0b18ef5a2@email.android.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1390929120 6076 80.91.229.3 (28 Jan 2014 17:12:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 Jan 2014 17:12:00 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4526-gllmg-musl=m.gmane.org@lists.openwall.com Tue Jan 28 18:12:08 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 1W8CCl-0006ww-1G for gllmg-musl@plane.gmane.org; Tue, 28 Jan 2014 18:12:07 +0100 Original-Received: (qmail 7240 invoked by uid 550); 28 Jan 2014 17:12:05 -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 7223 invoked from network); 28 Jan 2014 17:12:05 -0000 Content-Disposition: inline In-Reply-To: <500a674a-fd43-49f5-99b8-6fd0b18ef5a2@email.android.com> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:4522 Archived-At: 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. Rich