git/list[1] front-page[2] threads[3] people[4] search[5] about
 

RE: [Bug] git-log prints wrong unixtime with --date=format:%s

From
Randall S. Becker <rsbecker@nexbridge.com>
Date
May 18, 2016, 16:44 UTC
Message-ID
<005a01d1b124$976dceb0$c6496c10$@nexbridge.com>
In-Reply-To
<xmqqvb2bs5f5.fsf@gitster.mtv.corp.google.com>
On May 18, 2016 12:22 PM Jeff King wrote:
Show 11 quoted lines
> > 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
> 
> Wouldn't that be more like "UTC+0200"?
> 
> In any case, I do not think anybody wants to do tzset() on each and every
> commit while running "git log".  Can we declare "format:<strftime>"
> will always use the local timezone, or something?

Off the wall: Dealing in a dispersed team sharing a server that has a timezone local for only two of the members, git log messes with me also from a TZ POV. I would like to suggest a more general solution, like configuring my own TZ in ~/.gitconfig which would potentially allow an override on the command line. Would user.timezone be helpful in this situation and if set, call setenv("TZ=...")? It's not an issue when I'm local, but if I touch a clone on the server, even I get confused around DST changes in October ;).

Cheers, Randall

-- Brief whoami: NonStop&UNIX developer since approximately UNIX(421664400)/NonStop(211288444200000000) -- In my real life, I talk too much.

Previous: Junio C HamanoNext: Jeff King
Message 6 of 12 in “[Bug] git-log prints wrong unixtime with --date=format:%s”
  1. Michael HeerdegenMay 16, 2016
  2. Michael HeerdegenMay 17, 2016
  3. Jeff KingMay 18, 2016
  4. Jeff KingMay 18, 2016
  5. Junio C HamanoMay 18, 2016
  6. Randall S. BeckerMay 18, 2016
  7. Jeff KingMay 18, 2016
  8. Jeff KingMay 18, 2016
  9. Michael HeerdegenMay 18, 2016
  10. Jeff KingMay 19, 2016
  11. Michael HeerdegenMay 19, 2016
  12. Michael HeerdegenMay 18, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.