This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bash unable to print epoch timestamp


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

Attachment: pgp2o9BEWCRq_.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]