Re: Potentially misleading documentation of SECONDS variable

2024-08-18 Thread Martin D Kealey
The fundamental problem of using phrases like "the run time of the current process" is that there's NO POSSIBLE adjectival qualifier that can be added to such a phrase such that the combination correctly describes the actual operation. What's needed is a statement that the value of SECONDS is the

Re: Potentially misleading documentation of SECONDS variable

2024-08-14 Thread felix
The variable $SECOND won't intend to be exact to the nanoseconds! Not even to 1/100th... This variable is intended to show current time of execution, at SECOND resolution. This variable is simply incremented each time SYSTEM CLOCK increment his SECOND part of current time. Try this little command

Re: Potentially misleading documentation of SECONDS variable

2024-08-07 Thread Chet Ramey
On 8/7/24 10:10 AM, G. Branden Robinson wrote: At the risk of splitting hairs, I would cast the added phrase as: "at a resolution of one second". I used "one-second resolution," actually. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevi

Re: Potentially misleading documentation of SECONDS variable

2024-08-07 Thread G. Branden Robinson
At 2024-08-07T10:07:23-0400, Chet Ramey wrote: > On 8/6/24 12:25 PM, Koichi Murase wrote: > > > diff --git a/doc/bash.1 b/doc/bash.1 > > index 1f0a23d3..3ace21e9 100644 > > --- a/doc/bash.1 > > +++ b/doc/bash.1 > > @@ -2091,7 +2091,7 @@ the value returned upon subsequent > > references is > >

Re: Potentially misleading documentation of SECONDS variable

2024-08-07 Thread Chet Ramey
On 8/6/24 12:25 PM, Koichi Murase wrote: diff --git a/doc/bash.1 b/doc/bash.1 index 1f0a23d3..3ace21e9 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -2091,7 +2091,7 @@ the value returned upon subsequent references is the number of seconds since the assignment plus the value assigned. The num

Re: Potentially misleading documentation of SECONDS variable

2024-08-06 Thread Ángel
On 2024-08-06 at 17:17 +0200, Bash-help via Bug reports for the GNU Bourne Again SHell wrote: > #!/bin/bash > > while true; do > SECONDS=0 > sleep 0.5 > if [ "$SECONDS" != "0" ]; then > printf 'This is unexpected: %s != 0\n' "$SECONDS" > fi > done > > As we sleep less than

Re: Potentially misleading documentation of SECONDS variable

2024-08-06 Thread bash
On Tue, Aug 06, 2024 at 03:58:35PM -0400, Chet Ramey wrote: > [...] Bash has never looked at > anything but whole seconds. [...] > Ok, cool. So this is not a bug but rather just how Bash works. That's fine but then I think the documentation could reflect the actual behaviour better. I found this "

Re: Potentially misleading documentation of SECONDS variable

2024-08-06 Thread Chet Ramey
On 8/6/24 11:17 AM, Bash-help via Bug reports for the GNU Bourne Again SHell wrote: Reading the manual at regarding the SECONDS variable, it states that " [..] Assignment to this variable resets the count to the value assigned, a

Re: Potentially misleading documentation of SECONDS variable

2024-08-06 Thread bash
On Wed, Aug 07, 2024 at 01:25:35AM +0900, Koichi Murase wrote: > is supposed to imply that technically. It says "The number of seconds > at shell invocation", so the starting time point is considered to have > only the "second" resolution and doesn't have the subsecond > resolution. Then, when a va

Re: Potentially misleading documentation of SECONDS variable

2024-08-06 Thread alex xmb sw ratchev
i think this includes if u start a bash set clock 1h to future and query after 1s , it may show not 0 or 1 second On Tue, Aug 6, 2024, 18:26 Koichi Murase wrote: > 2024年8月7日(水) 0:24 Bash-help via Bug reports for the GNU Bourne Again > SHell : > > Reading the manual at > >

Re: Potentially misleading documentation of SECONDS variable

2024-08-06 Thread Koichi Murase
2024年8月7日(水) 0:24 Bash-help via Bug reports for the GNU Bourne Again SHell : > Reading the manual at > > regarding the SECONDS variable, it states that > " [..] Assignment to this variable resets the count to the value assigned, >

Re: Potentially misleading documentation of SECONDS variable

2024-08-06 Thread alex xmb sw ratchev
try unset -v SECONDS first On Tue, Aug 6, 2024, 17:24 Bash-help via Bug reports for the GNU Bourne Again SHell wrote: > Reading the manual at > > regarding the SECONDS variable, it states that > " [..] Assignment to this varia

Potentially misleading documentation of SECONDS variable

2024-08-06 Thread Bash-help via Bug reports for the GNU Bourne Again SHell
Reading the manual at regarding the SECONDS variable, it states that " [..] Assignment to this variable resets the count to the value assigned, and the expanded value becomes the value assigned plus the number of seconds since the