Re: [PATCH] strbuf: let strbuf_addftime handle %z and %Z itself

2017-06-13 Thread Ulrich Mueller
> On Tue, 13 Jun 2017, René Scharfe wrote: > Am 12.06.2017 um 21:02 schrieb Ævar Arnfjörð Bjarmason: >> Which gives me a pretty good idea of where the people who are making >> my colleges / collaborators who are making commits all over the world >> are located, for the purposes of reinforcing

Re: [PATCH] strbuf: let strbuf_addftime handle %z and %Z itself

2017-06-13 Thread Ævar Arnfjörð Bjarmason
On Tue, Jun 13, 2017 at 12:31 AM, René Scharfe wrote: > Am 12.06.2017 um 21:02 schrieb Ævar Arnfjörð Bjarmason: >> >> I only ever use the time offset info to quickly make a mental note of >> "oh +0200, this guy's in Europe", or "oh -0400 America East". Having >> any info at all for

Re: [PATCH] strbuf: let strbuf_addftime handle %z and %Z itself

2017-06-13 Thread Linus Torvalds
On Mon, Jun 12, 2017 at 2:10 PM, Jeff King wrote: > > I suspect nobody has complained because we generally encourage real > "-0800" names when specifying zones. That's what any sane person uses, and it's what SMTP requiries. The timezone names are a (bad) joke. If a human can't

Re: [PATCH] strbuf: let strbuf_addftime handle %z and %Z itself

2017-06-12 Thread René Scharfe
Am 12.06.2017 um 21:02 schrieb Ævar Arnfjörð Bjarmason: I only ever use the time offset info to quickly make a mental note of "oh +0200, this guy's in Europe", or "oh -0400 America East". Having any info at all for %Z would allow me to easily replace that already buggy mapping that exists in my

Re: [PATCH] strbuf: let strbuf_addftime handle %z and %Z itself

2017-06-12 Thread Jeff King
On Mon, Jun 12, 2017 at 09:02:32PM +0200, Ævar Arnfjörð Bjarmason wrote: > > I think the main problem is that the mapping isn't just "JST->+0900". > > It's a set of rules that depend on the specific time being converted. So > > it's true that at some time t, +0900 may mean JST or KST or whatever.

Re: [PATCH] strbuf: let strbuf_addftime handle %z and %Z itself

2017-06-12 Thread Ævar Arnfjörð Bjarmason
On Mon, Jun 12, 2017 at 8:20 PM, Jeff King wrote: > On Mon, Jun 12, 2017 at 07:53:21PM +0200, Ævar Arnfjörð Bjarmason wrote: > >> >> Of course we can never know if you were in Tokyo or Seul from the info >> >> in the commit object, but we don't need to, it's enough that we just >>

Re: [PATCH] strbuf: let strbuf_addftime handle %z and %Z itself

2017-06-12 Thread Jeff King
On Mon, Jun 12, 2017 at 07:53:21PM +0200, Ævar Arnfjörð Bjarmason wrote: > >> Of course we can never know if you were in Tokyo or Seul from the info > >> in the commit object, but we don't need to, it's enough that we just > >> emit JST for +0900 and anyone reading the output has at least some >

Re: [PATCH] strbuf: let strbuf_addftime handle %z and %Z itself

2017-06-12 Thread Junio C Hamano
Ævar Arnfjörð Bjarmason writes: > On Mon, Jun 12, 2017 at 6:56 PM, Ulrich Mueller wrote: > >> Please don't. Outputting invented information for something that >> really isn't in the data is worse than outputting no information at >> all. > > It's not invented

Re: [PATCH] strbuf: let strbuf_addftime handle %z and %Z itself

2017-06-12 Thread Ævar Arnfjörð Bjarmason
On Mon, Jun 12, 2017 at 6:56 PM, Ulrich Mueller wrote: >> On Mon, 12 Jun 2017, Ęvar Arnfjörš Bjarmason wrote: > >> On Mon, Jun 12, 2017 at 5:12 PM, Junio C Hamano wrote: >>> René Scharfe writes: Yes, or you could look up a time zone

Re: [PATCH] strbuf: let strbuf_addftime handle %z and %Z itself

2017-06-12 Thread Jeff King
On Mon, Jun 12, 2017 at 06:58:13PM +0200, René Scharfe wrote: > > We could also simply replace "%Z" with the empty string, as the the > > POSIX strftime() documentation allows for: > > http://pubs.opengroup.org/onlinepubs/009695399/functions/strftime.html > > ("Replaced by the timezone name or

Re: [PATCH] strbuf: let strbuf_addftime handle %z and %Z itself

2017-06-12 Thread René Scharfe
Am 12.06.2017 um 18:16 schrieb Ævar Arnfjörð Bjarmason: On Mon, Jun 12, 2017 at 5:12 PM, Junio C Hamano wrote: René Scharfe writes: Am 07.06.2017 um 10:17 schrieb Jeff King: On Sat, Jun 03, 2017 at 12:40:34PM +0200, René Scharfe wrote: Duplicates

Re: [PATCH] strbuf: let strbuf_addftime handle %z and %Z itself

2017-06-12 Thread Ulrich Mueller
> On Mon, 12 Jun 2017, Ævar Arnfjörð Bjarmason wrote: > On Mon, Jun 12, 2017 at 5:12 PM, Junio C Hamano wrote: >> René Scharfe writes: >>> Yes, or you could look up a time zone name somewhere else -- except we >>> don't have a way to do that, at least for

Re: [PATCH] strbuf: let strbuf_addftime handle %z and %Z itself

2017-06-12 Thread Ævar Arnfjörð Bjarmason
On Mon, Jun 12, 2017 at 5:12 PM, Junio C Hamano wrote: > René Scharfe writes: > >> Am 07.06.2017 um 10:17 schrieb Jeff King: >>> On Sat, Jun 03, 2017 at 12:40:34PM +0200, René Scharfe wrote: Duplicates strbuf_expand to a certain extent, but not too badly, I

Re: [PATCH] strbuf: let strbuf_addftime handle %z and %Z itself

2017-06-12 Thread Junio C Hamano
René Scharfe writes: > Am 07.06.2017 um 10:17 schrieb Jeff King: >> On Sat, Jun 03, 2017 at 12:40:34PM +0200, René Scharfe wrote: >>> Duplicates strbuf_expand to a certain extent, but not too badly, I >>> think. Leaves the door open for letting strftime handle the local >>> case.

Re: [PATCH] strbuf: let strbuf_addftime handle %z and %Z itself

2017-06-11 Thread René Scharfe
Am 07.06.2017 um 10:17 schrieb Jeff King: On Sat, Jun 03, 2017 at 12:40:34PM +0200, René Scharfe wrote: Duplicates strbuf_expand to a certain extent, but not too badly, I think. Leaves the door open for letting strftime handle the local case. I guess you'd plan to do that like this in the

Re: [PATCH] strbuf: let strbuf_addftime handle %z and %Z itself

2017-06-07 Thread Jeff King
On Sat, Jun 03, 2017 at 12:40:34PM +0200, René Scharfe wrote: > There is no portable way to pass timezone information to strftime. Add > parameters for timezone offset and name to strbuf_addftime and let it > handle the timezone-related format specifiers %z and %Z internally. > Callers can opt

Re: [PATCH] strbuf: let strbuf_addftime handle %z and %Z itself

2017-06-03 Thread René Scharfe
Am 03.06.2017 um 15:13 schrieb Ulrich Mueller: On Sat, 3 Jun 2017, René Scharfe wrote: + case 'Z': + strbuf_addstr(_fmt, tz_name); Is it guaranteed that tz_name cannot contain a percent sign itself? Currently yes, because the only caller

Re: [PATCH] strbuf: let strbuf_addftime handle %z and %Z itself

2017-06-03 Thread Ulrich Mueller
> On Sat, 3 Jun 2017, René Scharfe wrote: > + case 'Z': > + strbuf_addstr(_fmt, tz_name); Is it guaranteed that tz_name cannot contain a percent sign itself? Ulrich

[PATCH] strbuf: let strbuf_addftime handle %z and %Z itself

2017-06-03 Thread René Scharfe
There is no portable way to pass timezone information to strftime. Add parameters for timezone offset and name to strbuf_addftime and let it handle the timezone-related format specifiers %z and %Z internally. Callers can opt out by passing NULL as timezone name. Use an empty string as timezone