git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: git@vger.kernel.org
Subject: Re: [Bug] git-log prints wrong unixtime with --date=format:%s
Date: Tue, 17 May 2016 20:58:25 -0400	[thread overview]
Message-ID: <20160518005824.GA7120@sigill.intra.peff.net> (raw)
In-Reply-To: <20160518004008.GA20007@sigill.intra.peff.net>

On Tue, May 17, 2016 at 08:40:08PM -0400, Jeff King wrote:

> So we need some way to tell strftime "...and by the way, this is the
> timezone for the value we are currently feeding you." There isn't a slot
> in "struct tm" for that, but I think maybe you can hack around it by
> setting the global "timezone" variable (and then restoring it
> afterwards).

I tried a few obvious things, but couldn't make anything work. Setting
"timezone" manually seems to do nothing. It's supposed to be set by
putting the right thing in $TZ and then calling tzset(). So I tried
munging $TZ to something like "+0200". It did have _some_ effect, but I
couldn't get it to behave correctly in all situations. And using "%z"
and "%Z" always just gives GMT.

So I dunno. Perhaps there is some way to coax sane behavior out of
strftime, but I could not figure it out. Suggestions welcome.

-Peff

  reply	other threads:[~2016-05-18  0:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-16 23:33 [Bug] git-log prints wrong unixtime with --date=format:%s Michael Heerdegen
2016-05-17 17:25 ` Michael Heerdegen
2016-05-18  0:40   ` Jeff King
2016-05-18  0:58     ` Jeff King [this message]
2016-05-18 16:21       ` Junio C Hamano
2016-05-18 16:44         ` Randall S. Becker
2016-05-18 17:51           ` Jeff King
2016-05-18 17:49         ` Jeff King
2016-05-18 23:05           ` Michael Heerdegen
2016-05-19  1:54             ` Jeff King
2016-05-19 15:41               ` Michael Heerdegen
2016-05-18 22:57     ` Michael Heerdegen

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=20160518005824.GA7120@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=michael_heerdegen@web.de \
    /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).