bug-gawk
[Top][All Lists]
Advanced

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

Re: gawk: sigpipe1.awk:7: fatal: print to "yes | true" failed: Broken pi


From: Andrew J. Schorr
Subject: Re: gawk: sigpipe1.awk:7: fatal: print to "yes | true" failed: Broken pipe
Date: Fri, 12 Jan 2024 09:38:01 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Jan 12, 2024 at 03:02:49AM -0700, arnold@skeeve.com wrote:
> I have just now pushed changes so that both gawk and gettimeofday()
> use the same system call. clock_gettime() is preferred, then
> gettimeofday(), and then time().

Thanks!

In extension/time.c, this patch looks weird though:

+#if defined(HAVE_CLOCK_GETTIME)
+       {
+               struct timespec tv;
+               clock_gettime(CLOCK_REALTIME, & tv);
+               curtime = tv.tv_sec + 0.0;
+               curtime = tv.tv_sec+(tv.tv_nsec/1000000000.0);
+       }
+#elif defined(HAVE_GETTIMEOFDAY)

It seems that curtime is set twice; need to delete that first
stray line?

> I note that gettimeofday() can return a value that includes
> fractions of a second, whereas systime() only returns whole
> seconds. That may also be part of the problem.

The tests were in theory designed to account for that and be
nevertheless robust, but maybe I have a thinko. Let's hope this
change clears up the issue, although I'm not optimistic that the
back-end time sources are actually different.

Thanks,
Andy



reply via email to

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