git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Taylor Blau <me@ttaylorr.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Yucheng Zhou <zhouyucheng98@outlook.com>, git@vger.kernel.org
Subject: Re: Feature request for shorter relative date format in log
Date: Fri, 4 Aug 2023 14:24:50 -0400	[thread overview]
Message-ID: <ZM1Ccn766xge31Uo@nand.local> (raw)
In-Reply-To: <xmqqsf915b54.fsf@gitster.g>

On Wed, Aug 02, 2023 at 03:31:51PM -0700, Junio C Hamano wrote:
> Taylor Blau <me@ttaylorr.com> writes:
>
> > But we don't have a way for users to provide custom over relative dates.
>
> Are there existing systems to format time durations in a customized
> way, just like strftime() is a way way to custom-format a timestamp,
> that we can just use, or write our own modelling after them?

I'm not aware of such a utility, no. I had imagined that we would
represent the duration between two timestamps as another timestamp
offset that same amount after the Epoch. Then the caller could specify a
strftime format string and format the "duration" that way.

> The relative-time code decides which points in the time durection
> spectrum are good places to switch the granularity (e.g. up to 90
> seconds we will give "N seconds", and up to 90 minutes we will give
> "N minutes").  You could grep in date.c:show_date_relative() for
> Q_() and _(), and place them in an array and allow them to be
> replaced by strings in the configuration variable, but that will
> cover only one smaller half of the problem (i.e. how the "N seconds"
> are shown) and the other half (i.e. what variants there are, and
> which variant is used for what time duration---you cannot introduce
> a rule that says "up to 500 seconds, show 'N minutes M seconds'").
>
> Even with that solution to the smaller half will also create i18n
> headaches.

Yeah, I think mangling with those translation identifiers is going to be
a giant mess.

> No, I am not interested in working on such a solution myself.  But
> it will be an interesting puzzle.

Ditto ;-).

Thanks,
Taylor

      parent reply	other threads:[~2023-08-04 18:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-02  6:07 Feature request for shorter relative date format in log Yucheng Zhou
2023-08-02 18:12 ` Taylor Blau
2023-08-02 22:31   ` Junio C Hamano
2023-08-03  2:54     ` Yucheng Zhou
2023-08-04 18:24     ` Taylor Blau [this message]

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=ZM1Ccn766xge31Uo@nand.local \
    --to=me@ttaylorr.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=zhouyucheng98@outlook.com \
    /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).