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


Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes:

> 
> On Oct 26 19:16, Brian Inglis wrote:
> > On 2015-10-26 11:34, Brian Inglis wrote:
> > >Third time lucky - pasting inline into email and resending to all
previous lists.
> > >
> > >Please note that conversion into too-small buffer size in regression
test may not have expected result!
> > >
> > >Tried to build with below and variants:
> > >gcc -D_REGRESSION_TEST -D_COMPILING_NEWLIB -Dsniprintf=snprintf
> -I/usr/src/cygwin-2.2.1-1.src/newlib-cygwin/winsup/cygwin/include -o
strftime-s-test strftime.c
> > >gives undef refs for __cygwin_gettzname, __cygwin_gettzoffset,
__get_current_time_locale,
> __tz_lock, __tz_unlock,
> > >_tzset_unlocked
> > >
> > >Build stc with std cmdline and current strftime works and does demo issue.
> > 
> > Sorry - redo with the file existing!
> 
> No worries, I applied your other patch since it also cleaned up some
> whitespaces and, for some reason, the below patch didn't apply cleanly.

Email paste may have converted tabs to spaces - need to work out how to
email inline text attachments without tab expansion in tbird - paste on
gmane (below) seems to retain tabs - may try that in future. 

> There was just one problem:
> 
> > +	  {
> > +	    long offset;	/* offset < 0 => W of GMT, > 0 => E of GMT:
> > +	    offset = 0;	   subtract to get UTC */
> 
> This setting the offset to 0 is necessary, but commented out.  Typo?
> I fixed this before committing the patch.

Thanks - total brain fart - Doh! Interesting that gcc -Wall -Wextra did not
catch this - used to be reliable warning about conditionally uninitialized
variables! 

Please check that the second set of tests in Vec1 includes the following, as
it was not in my very first patch email, which you may not have received: 
@@ -1502,6 +1575,7 @@ const struct test  Vec1[] = {
 	{ CQ("%p"), 2+1, EXP(CQ("PM")) },
 	{ CQ("%r"), 11+1, EXP(CQ("11:01:13 PM")) },
 	{ CQ("%R"), 5+1, EXP(CQ("23:01")) },
+	{ CQ("%s"), 2+1, EXP(CQ("1215054073")) },
 	{ CQ("%S"), 2+1, EXP(CQ("13")) },
 	{ CQ("%t"), 1+1, EXP(CQ("\t")) },
 	{ CQ("%T"), 8+1, EXP(CQ("23:01:13")) },



--
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


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