bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Any chance gettimeofday() or other millis- or even nanos-precision t


From: arnold
Subject: Re: Any chance gettimeofday() or other millis- or even nanos-precision time function stays in the default Gawk distribution?
Date: Thu, 12 Jan 2023 11:39:03 -0700
User-agent: Heirloom mailx 12.5 7/5/10

Hi.

Andy and I have consulted a bit. I think I will just undeprecate
the time extension.

Good luck with your project!

Thanks,

Arnold

Volodymyr Gubarkov <xonixx@gmail.com> wrote:

> Makesure (https://github.com/xonixx/makesure) is a task/command runner that
> I’m developing. It’s sort of similar to the well-known make tool, but
> without most of its idiosyncrasies (and with a couple of unique features!).
>
> It may sound surprising, but I wrote it in AWK.
>
> One of the features of this tool is the ability to show timing for executed
> goals: https://github.com/xonixx/makesure#options
>
> Initially this was done via system() call to the built-in date command.
>
> But this is slow and on macOS (and, probably *BSD) doesn't provide
> ms-precision: https://github.com/xonixx/makesure/issues/51
>
> So I found a solution to rely on gettimeofday() function if Gawk is in use:
> https://github.com/xonixx/makesure/issues/57
>
> Overall it appears, there are very few options to get ms-precision timings
> via standard *nix utilities, and gawks's gettimeofday() is (was) one of
> them:
> https://stackoverflow.com/questions/16548528/command-to-get-time-in-milliseconds
>
>
> (I beg pardon for a long introduction that looks like advertising)
>
> So version GAWK 5.2.1 now shows "gawk: warning: The time extension is
> obsolete. Use the timex extension from gawkextlib instead."
>
> Fair enough. I totally get why the decision to deprecate this in favour of
> gawkextlib is made (
> https://lists.gnu.org/archive/html/bug-gawk/2019-10/msg00038.html).
>
>
> Obviously, for my tool this excludes the possibility to rely on this
> function, since the main point of using AWK for it is portability.
>
> From the other side, maybe it still does make sense to add gettimeofday()
> as a built-in function, the same way as Gawk has a set of Gawk-specific
> functions, like the latest mkbool()?
>
> Looking at the source code it doesn’t look like the implementation is
> terribly complex to support, but I can be wrong.
>
> From the other side, given the lack of consistent ms/ns-precision timing
> facility in standard *nix utilities, the function is really handy for
> precise time-measurement in your AWK code and not only.
>
> Best regards,
>
> Volodymyr



reply via email to

[Prev in Thread] Current Thread [Next in Thread]