Bash unable to print epoch timestamp
Corinna Vinschen
corinna-cygwin@cygwin.com
Mon Oct 26 10:50:00 GMT 2015
Brian, ping?
On Oct 22 10:46, Corinna Vinschen wrote:
> Hi Brian,
>
> On Oct 22 07:03, Brian Inglis wrote:
> > Brian Inglis <Brian.Inglis <at> SystematicSw.ab.ca> writes:
> >
> > >
> > > 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.
> >
> > > %s, as it is conditional on _WANT_C99_TIME_FORMATS being defined, and that
> > Wrong! Misread the code, strftime %s is not supported!
> >
> > STC and suggested patch appended (posting from gmane), compiles, but can't
> > build STC as ld fails with undef refs, and I don't know all the correct
> > LD..., -L and -l incantations. Email me for original files.
>
> Cool, thanks for the patch. Unfortunately it doesn't apply cleanly.
> There are several unexpected line wraps and there's this:
>
> > --- a/newlib/time/strftime.c 2015-08-20 03:39:24.000000000 -0600
> > +++ b/newlib/time/strftime.c 2015-10-21 20:15:22.367453000 -0600
>
> How did this happen? If you checkout the newlib-cygwin git repo,
> strftime.c is under newlib/libc/time, not under newlib/time :o
>
> Would you mind to attach a patch generated with git format-patch?
>
>
> Thanks in advance,
> Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20151026/6f39bb04/attachment.sig>
More information about the Cygwin
mailing list