Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 29 Jan 2014 19:45:25 +0800
From: orc <>
Subject: Re: syslog() always sends GMT timestamps

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()?


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.