From: Eric Sunshine Date: Sun, 30 Aug 2015 08:14:35 GMT Subject: Re: [FEATURE REQUEST] Filter-branch extend progress with a simple estimated time remaning Message-ID: In-Reply-To: On Sun, Aug 30, 2015 at 4:04 AM, Mikael Magnusson wrote: > On Sun, Aug 30, 2015 at 5:15 AM, Eric Sunshine wrote: >> On Sat, Aug 29, 2015 at 11:00 PM, Gabor Bernat wrote: >>> Reading after it, I think the most close we can get with this is, awk >>> 'BEGIN { print strftime("%c", 1271603087); }; and just ignore setting >>> this value (and avoid displaying it) if that fails too. Do you agree? >> >> strftime() in awk is a GNU-ism. It doesn't exist in awk on Mac OS X or >> FreeBSD, or even the default awk on Linux (which is mawk on Linux >> installations I've checked). >> >> Most portable likely would be Perl, however, that's probably too >> heavyweight inside a loop like this, even if called only once each N >> iterations. > > 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. Indeed, this seems to be portable in my tests, and presumably works on Solaris, whereas "date +%s" doesn't (according to that stackoverflow answer). > this can work instead of the data command for getting the time > elapsed, however for getting the actual date of a timestamp is not > possible generally; so I think I will just remove that part. Agreed. I was going to suggest the same.