This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Bash unable to print epoch timestamp
- From: Brian Inglis <Brian dot Inglis at SystematicSw dot ab dot ca>
- To: cygwin at cygwin dot com
- Date: Thu, 22 Oct 2015 00:05:53 +0000 (UTC)
- Subject: Re: Bash unable to print epoch timestamp
- Authentication-results: sourceware.org; auth=none
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