[systemd-devel] [PATCH v2] journalctl: add --utc option

Lennart Poettering mzerqung at 0pointer.de
Thu Oct 2 06:24:26 PDT 2014


On Thu, 02.10.14 15:19, Jan Synacek (jsynacek at redhat.com) wrote:

> Lennart Poettering <lennart at poettering.net> writes:
> > On Thu, 02.10.14 14:39, Jan Synacek (jsynacek at redhat.com) wrote:
> >
> >> Introduce option to display time in UTC.
> >
> > Thanks!
> >
> > Applied!
> 
> Thanks! I just realized that the patch was incomplete. There are at
> least two different places that need to be patched - format_timestamp()
> and format_timestamp_us() in src/shared/time-util.c. I'm not sure about
> the rest (grepping localtime_r reveals some more uses). I would extend
> the API of those calls by one boolean saying if they should use UTC or
> not, however that would break API. Would that be OK? Or do you suggest
> anything else?

Hmm, I'd probably rename format_timestamp() to
format_timestamp_internal(), add the bool to it, and then make
format_timestamp() just invoke that with the bool set to false, and
then add format_timestamp_utc() which calls it with true. That way you
don't have to patch that many invocations, and the invocations stay
more readable.

(breaking internal API is fine btw, we only need to be careful with
exported API.)

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list