Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -DDEFAULT_PATH_VALUE='/usr/local/ uname output: Linux t420 5.10.54-1-lts #1 SMP Wed, 28 Jul 2021 15:05:20 +0000 x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu
Bash Version: 5.1 Patch Level: 8 Release Status: release Description: > static SHELL_VAR * > get_epochrealtime (var) > SHELL_VAR *var; > { > char buf[32]; > char *p; > struct timeval tv; > > gettimeofday (&tv, NULL); > snprintf (buf, sizeof (buf), "%u%c%06u", (unsigned)tv.tv_sec, > locale_decpoint (), > (unsigned)tv.tv_usec); > > p = savestring (buf); > FREE (value_cell (var)); > var_setvalue (var, p); > return (var); > } 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. > APPLICATION USAGE > Applications should use the clock_gettime() function instead of the > obsolescent gettimeofday() function. > [...] > FUTURE DIRECTIONS > The gettimeofday() function may be removed in a future version. > [...] > Issue 7 > The gettimeofday() function is marked obsolescent. I have also read that gettimeofday() is considered obsolete and is deprecated by POSIX. See: https://pubs.opengroup.org/onlinepubs/9699919799/functions/gettimeofday.html Repeat-By: $ faketime 1969-01-01 bash -c 'declare -p EPOCHSECONDS EPOCHREALTIME' declare -- EPOCHSECONDS="-31539600" declare -- EPOCHREALTIME="4263427696.758887"