mailing list of musl libc
 help / color / mirror / code / Atom feed
From: orc <orc@sibserver.ru>
To: musl@lists.openwall.com
Subject: Re: syslog() always sends GMT timestamps
Date: Wed, 29 Jan 2014 19:45:25 +0800	[thread overview]
Message-ID: <770108a1-99d7-4ef0-b860-b045866c9895@email.android.com> (raw)
In-Reply-To: <20140128171153.GL24286@brightrain.aerifal.cx>

Rich Felker <dalias@aerifal.cx> пишет:
>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




  reply	other threads:[~2014-01-29 11:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-28 11:39 orc
2014-01-28 17:11 ` Rich Felker
2014-01-29 11:45   ` orc [this message]
2014-01-30  4:33     ` Rich Felker
2014-01-30 12:04       ` Szabolcs Nagy
2014-02-01  0:54         ` Rich Felker
2014-02-01  1:26           ` Laurent Bercot
2014-02-01  9:09             ` Szabolcs Nagy
2014-02-01 11:01               ` Christian Wiese
2014-02-01 15:48               ` Laurent Bercot
2014-02-01 17:07                 ` Paul Schutte
2014-02-01  9:38           ` orc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=770108a1-99d7-4ef0-b860-b045866c9895@email.android.com \
    --to=orc@sibserver.ru \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).