Re: EPOCHREALTIME does not behave correctly before 1970

2021-08-22 Thread Chet Ramey
On 8/22/21 7:52 PM, Kerin Millar wrote: On Sun, 22 Aug 2021 16:13:28 -0400 Chet Ramey wrote: On 8/21/21 1:28 AM, Emanuele Torre wrote: Bash Version: 5.1 Patch Level: 8 Release Status: release get_epochrealtime() casts tv.tv_sec (a time_t a.k.a. int) to unsigned int causing EPOCHREALTIME

Re: EPOCHREALTIME does not behave correctly before 1970

2021-08-22 Thread Kerin Millar
On Sun, 22 Aug 2021 16:13:28 -0400 Chet Ramey wrote: > On 8/21/21 1:28 AM, Emanuele Torre wrote: > > > Bash Version: 5.1 > > Patch Level: 8 > > Release Status: release > > > > > get_epochrealtime() casts tv.tv_sec (a time_t a.k.a. int) to unsigned >

Re: EPOCHREALTIME does not behave correctly before 1970

2021-08-22 Thread Alex fxmbsw7 Ratchev
lol undefined behavior, tho its important to test such important functionality, as setting time back bad book by the live of 'use your computer only so' im just saying nowadays as earlier software is more ugly bugs than useful On Sun, Aug 22, 2021, 23:28 Greg Wooledge wrote: > On Sun, Aug 22,

Re: EPOCHREALTIME does not behave correctly before 1970

2021-08-22 Thread Greg Wooledge
On Sun, Aug 22, 2021 at 10:30:26PM +0200, Alex fxmbsw7 Ratchev wrote: > why disregard or invalid, mark 0 is that date, less is minus, .. all working It's not that simple. Calendars get really *interesting* if you go farther back in history. The switch from the Julian to the Gregorian calendar

Re: EPOCHREALTIME does not behave correctly before 1970

2021-08-22 Thread Alex fxmbsw7 Ratchev
ochrealtime() casts tv.tv_sec (a time_t a.k.a. int) to unsigned > > int causing EPOCHREALTIME to not behave correctly before the Unix Epoch. > > The definition is seconds since the Unix epoch. It's not surprising that it > doesn't pay attention to dates before that. > > -- &

Re: EPOCHREALTIME does not behave correctly before 1970

2021-08-22 Thread Chet Ramey
On 8/21/21 1:28 AM, Emanuele Torre wrote: Bash Version: 5.1 Patch Level: 8 Release Status: release get_epochrealtime() casts tv.tv_sec (a time_t a.k.a. int) to unsigned int causing EPOCHREALTIME to not behave correctly before the Unix Epoch. The definition is seconds since the Unix epoch

Re: EPOCHREALTIME does not behave correctly before 1970

2021-08-21 Thread Robert Elz
Date:Sat, 21 Aug 2021 07:28:23 +0200 From:Emanuele Torre Message-ID: | I have also read that gettimeofday() is considered obsolete and is | deprecated by POSIX. It is being removed as a required interface, but it still exists everywhere (and will for a very

EPOCHREALTIME does not behave correctly before 1970

2021-08-21 Thread Emanuele Torre
() casts tv.tv_sec (a time_t a.k.a. int) to unsigned int causing EPOCHREALTIME to not behave correctly before the Unix Epoch. > APPLICATION USAGE > Applications should use the clock_gettime() function instead of the > obsolescent gettimeofday() function. > [...] > FUTU

Re: EPOCHREALTIME

2021-08-19 Thread Eli Schwartz
On 8/19/21 12:18 PM, Léa Gris wrote: > Le 19/08/2021 à 16:41, Eli Schwartz écrivait : >> On 8/19/21 9:41 AM, Léa Gris wrote: > > >> The error occurs, one would imagine, during the "convert string to >> float" stage, after parsing argv or forking to bc or whatever, but >> *before* passing it as

Re: EPOCHREALTIME

2021-08-19 Thread Greg Wooledge
On Thu, Aug 19, 2021 at 06:18:46PM +0200, Léa Gris wrote: > printf arguments are program source even if argument comes from a variable. I don't agree with this. I'd say that the *first* argument of printf is part of the program source code, and any additional arguments given are typically data,

Re: EPOCHREALTIME

2021-08-19 Thread Léa Gris
Le 19/08/2021 à 16:41, Eli Schwartz écrivait : On 8/19/21 9:41 AM, Léa Gris wrote: The error occurs, one would imagine, during the "convert string to float" stage, after parsing argv or forking to bc or whatever, but *before* passing it as an argument to printf(3). Here, bash is just doing

Re: EPOCHREALTIME

2021-08-19 Thread Greg Wooledge
On Thu, Aug 19, 2021 at 10:30:39AM -0400, Chet Ramey wrote: > On 8/19/21 9:41 AM, Léa Gris wrote: > > This will fail because of questionable design decision of having a mutable > > argument format: > > > > LC_NUMERIC=fr_FR@UTF-8; printf 'Pi: %2.4f\n` "$(bc -l <<<'4*a(1)')" > > > > Note how the

Re: EPOCHREALTIME

2021-08-19 Thread Eli Schwartz
On 8/19/21 9:41 AM, Léa Gris wrote: > Le 19/08/2021 à 15:10, hancooper écrivait : >> Thusly, EPOCHREALTIME should not be made to depend on the locale.  I >> have seen many >> workarounds, that complicate rather than simplify something that >> should be straighforwar

Re: EPOCHREALTIME

2021-08-19 Thread Chet Ramey
On 8/19/21 9:41 AM, Léa Gris wrote: > This will fail because of questionable design decision of having a mutable > argument format: > > LC_NUMERIC=fr_FR@UTF-8; printf 'Pi: %2.4f\n` "$(bc -l <<<'4*a(1)')" > > Note how the format indicator still use a dot, but the argument format's > decimal

Re: EPOCHREALTIME

2021-08-19 Thread Léa Gris
Le 19/08/2021 à 15:10, hancooper écrivait : Thusly, EPOCHREALTIME should not be made to depend on the locale. I have seen many workarounds, that complicate rather than simplify something that should be straighforward and germaine to direct numeric computation. A agree 100

Re: EPOCHREALTIME

2021-08-19 Thread Ilkka Virta
On Thu, Aug 19, 2021 at 4:12 PM hancooper wrote: > On Thursday, August 19, 2021 12:58 PM, Léa Gris > wrote: > > (LC_NUMERIC=C; echo "$EPOCHREALTIME") > > the unix time stamp is merely the number of > seconds between a particular date and the epoch. Technica

EPOCHREALTIME

2021-08-19 Thread hancooper
‐‐‐ Original Message ‐‐‐ On Thursday, August 19, 2021 12:58 PM, Léa Gris wrote: > Le 19/08/2021 à 14:43, hancooper via Bug reports for the GNU Bourne > Again SHell écrivait : > > > Have been using $EPOCHREALTIME but can see that the output is as follows. > &

Re: EPOCHREALTIME

2021-08-19 Thread Léa Gris
Le 19/08/2021 à 14:43, hancooper via Bug reports for the GNU Bourne Again SHell écrivait : Have been using $EPOCHREALTIME but can see that the output is as follows. 1629376497,853634 The utilisation of tho comma `,` is very inconvenient for those who want to do time computations. A change

EPOCHREALTIME

2021-08-19 Thread hancooper via Bug reports for the GNU Bourne Again SHell
Have been using $EPOCHREALTIME but can see that the output is as follows. 1629376497,853634 The utilisation of tho comma `,` is very inconvenient for those who want to do time computations. A change towards a period `.` would be the proper way to display the variable. Furthermore, one gets

Re: Difference between EPOCHREALTIME and EPOCHSECONDS

2020-04-14 Thread Chet Ramey
On 4/14/20 1:43 PM, Martin Schulte wrote: > Hello Chet, hello Felix, hello all! > >>> Bash Version: 5.0 >>> Patch Level: 16 >>> Release Status: release >>> >>> Description: >>> Integer part of $EPOCHREALTIME could increase mor

Re: Difference between EPOCHREALTIME and EPOCHSECONDS

2020-04-14 Thread Martin Schulte
Hello Chet, hello Felix, hello all! > > Bash Version: 5.0 > > Patch Level: 16 > > Release Status: release > > > > Description: > > Integer part of $EPOCHREALTIME could increase more than 8000 > > microseconds before $EPOCHSECONDS > > It'

Re: Difference between EPOCHREALTIME and EPOCHSECONDS

2020-04-14 Thread Chet Ramey
On 4/14/20 4:41 AM, fe...@f-hauri.ch wrote: > Bash Version: 5.0 > Patch Level: 16 > Release Status: release > > Description: > Integer part of $EPOCHREALTIME could increase more than 8000 > microseconds > before $EPOCHSECONDS It's the difference between

Difference between EPOCHREALTIME and EPOCHSECONDS

2020-04-14 Thread felix
: 16 Release Status: release Description: Integer part of $EPOCHREALTIME could increase more than 8000 microseconds before $EPOCHSECONDS Repeat-By: epochVariableDiff () { local errcnt=0 lasterrcnt v1 v2 v3 us vals line while ((errcnt==0)) || ((errcnt