Bash unable to print epoch timestamp
Brian Inglis
Brian.Inglis@SystematicSw.ab.ca
Thu Oct 22 07:04:00 GMT 2015
Don Harrop <don <at> effx.us> writes:
> Bash outputs no value when using it's built in method of printing an
> "epoch" timestamp.
> BashCommandLine#: printf '%(%s)T' -1
bash printf depends on underlying strftime in newlib, which does not support
%s, as it is conditional on _WANT_C99_TIME_FORMATS being defined, and that
is presumably not defined in the config, as %s is not shown in man strftime.
Workaround for now is use
date +%s
for current time, and
date -d $(printf '%(%T)T' -2) +%s
for shell invocation time.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list