git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: John Keeping <john@keeping.me.uk>
Cc: git@vger.kernel.org
Subject: Re: Timezone with DATE_STRFTIME
Date: Mon, 8 Feb 2016 10:44:15 -0500	[thread overview]
Message-ID: <20160208154414.GA19978@sigill.intra.peff.net> (raw)
In-Reply-To: <20160208152858.GA17226@sigill.intra.peff.net>

On Mon, Feb 08, 2016 at 10:28:58AM -0500, Jeff King wrote:

> So I think the fix is probably just that we need to feed the zone
> information to strftime via the "struct tm".

Ugh, I forgot how horrible the strftime interface is.

There is no zone information in "struct tm". It gets pulled from the
magic global variable "timezone", and you're supposed to use "tzset" to
set it up. We don't. POSIX says:

  Local timezone information is used as though strftime() called
  tzset().

but on my system that does not seem to be the case. At any rate, our
options are:

  1. Trying to munge a global variable with the timezone information we
     have just for the duration of our strftime call.

or

  2. Admit that strftime's "%z" is crap, and tell people not to use it.

I think I am leaning towards the latter, though unfortunately I don't
think there is a way to find out the author's timezone via
--date=format, then. Perhaps it should default to "--date=format-local:".

-Peff

  reply	other threads:[~2016-02-08 15:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-08 14:33 Timezone with DATE_STRFTIME John Keeping
2016-02-08 15:28 ` Jeff King
2016-02-08 15:44   ` Jeff King [this message]
2016-02-08 15:46   ` John Keeping

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=20160208154414.GA19978@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=john@keeping.me.uk \
    /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.
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).