On Sun, 22 Aug 2021 16:13:28 -0400 Chet Ramey <chet.ra...@case.edu> 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 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. The problem with this statement is that EPOCHREALTIME is permitted to get it wrong, yet EPOCHSECONDS is permitted to get it right. The discrepancy certainly came as a surprise to me. $ TZ=UTC faketime '1970-01-01' bash -c 'declare -p EPOCHSECONDS' declare -- EPOCHSECONDS="0" $ TZ=UTC faketime '1969-12-31' bash -c 'declare -p EPOCHSECONDS' declare -- EPOCHSECONDS="-86400" -- Kerin Millar