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

Re: Timezone with DATE_STRFTIME

From
Jeff King <peff@peff.net>
Date
Feb 8, 2016, 15:44 UTC
Message-ID
<20160208154414.GA19978@sigill.intra.peff.net>
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
Previous: Jeff KingNext: John Keeping
Message 3 of 4 in “Timezone with DATE_STRFTIME”
  1. John KeepingFeb 8, 2016
  2. Jeff KingFeb 8, 2016
  3. Jeff KingFeb 8, 2016
  4. John KeepingFeb 8, 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.