git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Mikael Magnusson <mikachu@gmail.com>,
	Gabor Bernat <bernat@primeranks.net>, Jeff King <peff@peff.net>,
	Git List <git@vger.kernel.org>
Subject: Re: [FEATURE REQUEST] Filter-branch extend progress with a simple estimated time remaning
Date: Sun, 30 Aug 2015 15:40:20 -0400	[thread overview]
Message-ID: <CAPig+cTf2YLWGi2swmMxdx_XpEU=GkAx11ng6VVACMX9NpA_SQ@mail.gmail.com> (raw)
In-Reply-To: <xmqqd1y4zpjx.fsf@gitster.mtv.corp.google.com>

On Sun, Aug 30, 2015 at 12:52 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>> http://stackoverflow.com/questions/2445198/get-seconds-since-epoch-in-any-posix-compliant-shell
>>> Found this,
>>>
>>> awk 'BEGIN{srand();print srand()}'
>>>
>>> srand() in awk returns the previous seed value, and calling it without
>>> an argument sets it to time of day, so the above sequence should
>>> return seconds since the epoch, or at least something in seconds that
>>> is relative to a fixed point which is all that's needed in this
>>> thread.
>
> In practice this should work, but it makes me feel somewhat uneasy.
>
> POSIX says "Set the seed value for rand to expr or use the time of
> day if expr is omitted. The previous seed value shall be returned."
> but I do not see anything that says that "the time of day" is
> counted in seconds around there (which is the crucial bit for this
> application).
>
> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html
> (4.15 Seconds since the Epoch) says "The relationship between the
> actual time of day and the current value for seconds since the Epoch
> is unspecified."

I suppose a viable approach might be to test once outside the loop if
"date +%s" is supported and print the "(%d elapsed / %d estimated
remaining)" annotation within the loop if it is, else not. The test
might look something like this:

echo $(date +%s) | grep -q '^[0-9][0-9]*$' 2>/dev/null && show_eta=t

Platforms, such as Linux, Mac OS X, and FreeBSD, which support "date
+%s" would get the annotated output, whereas it would fall back
gracefully to the non-annotated output on platforms such as Solaris
(and perhaps AIX) which lack it.

  parent reply	other threads:[~2015-08-30 19:40 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-25 15:01 [FEATURE REQUEST] Filter-branch extend progress with a simple estimated time remaning Gabor Bernat
2015-08-25 17:12 ` Jeff King
2015-08-25 18:33   ` Junio C Hamano
2015-08-25 18:52     ` Jeff King
2015-08-25 18:54       ` Jeff King
2015-08-25 20:07         ` Gabor Bernat
2015-08-25 20:12         ` Eric Sunshine
2015-08-26  2:15           ` Jeff King
2015-08-29  9:50             ` Gabor Bernat
2015-08-29 13:29               ` Gabor Bernat
2015-08-30  1:20                 ` Eric Sunshine
2015-08-30  3:00                   ` Gabor Bernat
2015-08-30  3:15                     ` Eric Sunshine
2015-08-30  8:04                       ` Mikael Magnusson
2015-08-30  8:11                         ` Gabor Bernat
2015-08-30  8:14                           ` Mikael Magnusson
2015-08-30  8:14                         ` Eric Sunshine
2015-08-30 16:52                           ` Junio C Hamano
2015-08-30 16:58                             ` Gabor Bernat
2015-08-30 19:53                               ` Mikael Magnusson
2015-08-30 19:55                               ` Eric Sunshine
2015-08-30 19:40                             ` Eric Sunshine [this message]
2015-08-30 20:40                               ` Eric Sunshine
2015-08-31  5:06                               ` Junio C Hamano

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='CAPig+cTf2YLWGi2swmMxdx_XpEU=GkAx11ng6VVACMX9NpA_SQ@mail.gmail.com' \
    --to=sunshine@sunshineco.com \
    --cc=bernat@primeranks.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mikachu@gmail.com \
    --cc=peff@peff.net \
    /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).