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

Re: [RFC PATCH 0/1] adding user.hideTimezone for setting UTC timezone

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Oct 1, 2020, 03:43 UTC
Message-ID
<20201001034350.GB2930867@google.com>
In-Reply-To
<xmqqtuved70y.fsf@gitster.c.googlers.com>
Junio C Hamano wrote:
Show 7 quoted lines
>                                                Our setenv() may not
> be early enough---before the code that decides to call a setenv()
> is run, there are many things that are outside your control (like
> the tracing subsystem, repository discovery, etc.) will run, and if
> any of them does something that triggers tzset() to be called, it
> will be done with the value of TZ the process started with, and our
> setenv() that happens much later won't have any effect to it.

I thought about this before, but in fact it's okay: when calling a function like localtime() (though not localetime_r() --- see my other reply), tzset() is called each time so it is able to reflect any updates to the TZ envvar from the interim.

[....]
Show 8 quoted lines
> You can let the existing code produce its natural result and then
> when the "force UTC" flag is set, override the offset part to +0000
> if and only if the timezone was obtained from the current
> environment (this if-and-only-if is necessary, because you do not
> want to rewrite and force UTC when you run "git commit --amend"
> without the "--reset-author" option to update a commit that was
> created somewhere else to UTC).  That way, we do not have to futz
> with TZ environment or tzset.

Yes, I think this is simpler and nicer than the proposal in my other reply.

In addition to not having to futz with TZ, I think I like the semantics better. The motivation that started this thread was not so much "I want to set a custom timezone to blend in" but rather "why are we recording the timezone at all here?" In that context, it makes sense to me to have a setting such as

	core.recordTimeZone

that I can turn *off* to say that I don't think datestamp() callers should consider the timezone to be information worth recording (and instead they should write +0000). To me that seems a little simpler to understand than user.hideTimezone since this focuses on turning some functionality off (recording of the time zone) instead of turning on a new stealth mode.

Thanks, Jonathan

Previous: Junio C HamanoNext: Junio C Hamano
Message 28 of 47 in “[ISSUE] Stop accessing, storing, and sharing the user's time zone”
  1. Nathaniel ManistaDec 5, 2019
  2. Junio C HamanoDec 5, 2019
  3. Randall S. BeckerDec 5, 2019
  4. Junio C HamanoDec 5, 2019
  5. Randall S. BeckerDec 5, 2019
  6. Santiago Torres AriasDec 5, 2019
  7. 0/1 adding user.hideTimezone for setting UTC timezoneShengfa Lin, Sep 30, 2020
  8. 1/1 hideTimezone: add a user.hideTimezone configShengfa Lin, Sep 30, 2020
  9. Junio C HamanoSep 30, 2020
  10. Junio C HamanoOct 1, 2020
  11. Shengfa LinOct 2, 2020
  12. Junio C HamanoOct 1, 2020
  13. Junio C HamanoOct 1, 2020
  14. Shengfa LinOct 2, 2020
  15. Shengfa LinOct 2, 2020
  16. Shengfa LinOct 2, 2020
  17. Shengfa LinOct 2, 2020
  18. Jonathan NiederOct 2, 2020
  19. Shengfa LinOct 2, 2020
  20. Junio C HamanoOct 3, 2020
  21. Junio C HamanoSep 30, 2020
  22. Shengfa LinOct 2, 2020
  23. Junio C HamanoOct 1, 2020
  24. Jonathan NiederOct 1, 2020
  25. Shengfa LinOct 2, 2020
  26. Junio C HamanoSep 30, 2020
  27. Junio C HamanoOct 1, 2020
  28. Jonathan NiederOct 1, 2020
  29. Junio C HamanoOct 1, 2020
  30. Junio C HamanoOct 8, 2020
  31. Shengfa LinOct 2, 2020
  32. Junio C HamanoOct 2, 2020
  33. Shengfa LinOct 3, 2020
  34. Junio C HamanoOct 3, 2020
  35. brian m. carlsonOct 3, 2020
  36. Junio C HamanoOct 3, 2020
  37. Shengfa LinOct 2, 2020
  38. Shengfa LinOct 2, 2020
  39. 0/2 experiment with commit option record-time-zoneShengfa Lin, Oct 13, 2020
  40. 2/2 Demonstrate failing and passing testsShengfa Lin, Oct 13, 2020
  41. 1/2 Adding a record-time-zone command option for commitShengfa Lin, Oct 13, 2020
  42. Junio C HamanoOct 13, 2020
  43. Shengfa LinOct 21, 2020
  44. Junio C HamanoOct 21, 2020
  45. Junio C HamanoOct 22, 2020
  46. Shengfa LinOct 26, 2020
  47. Junio C HamanoOct 9, 2020

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.