ash: add bash-compatible EPOCH variables
authorRon Yorston <rmy@pobox.com>
Mon, 15 Apr 2019 09:52:05 +0000 (10:52 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 16 Apr 2019 16:29:52 +0000 (18:29 +0200)
commit1d37186fe2361f80c821e334cc61f41e2f4eeb72
tree2bc64cbfd1864b446ecd0e1bc2de35d8ef8ed7eb
parentd96c69d87619e62a88cad1eeda795ac36b417c1c
ash: add bash-compatible EPOCH variables

Bash 5.0 added the dynamic variable EPOCHSECONDS and EPOCHREALTIME
which return the number of seconds since the Unix Epoch as an
integer or float.  These are useful for logging or tracing.

function                                             old     new   delta
change_epoch                                           -      78     +78
.rodata                                           175167  175235     +68
varinit_data                                         264     312     +48
change_seconds                                         -      24     +24
change_realtime                                        -      24     +24
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 2/0 up/down: 242/0)             Total: 242 bytes
   text    data     bss     dec     hex filename
 938508    4203    1888  944599   e69d7 busybox_old
 938702    4203    1888  944793   e6a99 busybox_unstripped

v2: Cast tv_sec and tv_usec to unsigned quantities.
    Add brackets to macros.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c