Re: GCC bug with strftime

2003-01-14 Thread Richard Troy

Thanks, Corinna,

...Good thing I've already written a work-around! -smile-

Gee, you never know what you might learn by posting on the wrong list!
-wink-

RT

-- 
Richard Troy, Chief Scientist
Science Tools Corporation
[EMAIL PROTECTED], 510-567-9957, http://ScienceTools.com/

On Tue, 14 Jan 2003, Corinna Vinschen wrote:

 Date: Tue, 14 Jan 2003 10:05:46 +0100
 From: Corinna Vinschen [EMAIL PROTECTED]
 Reply-To: [EMAIL PROTECTED]
 To: Cygwin [EMAIL PROTECTED]
 Subject: Re: GCC bug with strftime

 On Mon, Jan 13, 2003 at 07:00:07PM -0800, Richard Troy wrote:
The problem is that this call fails to return an hour:
   
strftime(IT,key,%m/%d/%y %l:%M %p, brokentime);

 I'm sorry to say that but...

  The answer is yes, I have checked. The code works in my various RedHat
  environments and has been for a long time. Also capital I is not what I

 ...just because it works under RH Linux it doesn't mean it's correct code.
 The %l specifier character is not covered by SUSv3:

 http://www.opengroup.org/onlinepubs/007904975/functions/strftime.html

 which means, your usage of %l is non-portable.

 Corinna




--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/




GCC bug with strftime

2003-01-13 Thread Richard Troy

Hi All,

It's been about eight months since I last posted to this list - hope
everyone is doing well...

I recently discovered a bug in strftime(). I downloaded a very recent copy
of cygwin and tried again, but it's still there. So, I'd like to report
it. I sent mail to the gcc-bugs list but nobody there seems to care, so I
thought I'd mention it here.

The problem is that this call fails to return an hour:

strftime(IT,key,%m/%d/%y %l:%M %p, brokentime);

The l% is supposed to represent a _space_ padded hour, as documented here:
http://www.gnu.org/manual/glibc-2.0.6/html_chapter/libc_17.html#SEC302

I wrote a test program to illustrate the problem - call it a bug script:

$ ./strftime

This program illustrates a bug with strftime as it fails to return the hour.
We are trying to use these flags: '%m/%d/%y %l:%M %p'
strftime returned: 01/09/03 :26 PM
The proper result: 01/09/03 3:26 PM
$

My workaround (in the bug script) gets the hour as two digits and then
tosses a leading zero... What a pain. -shrug-

I don't know how to check what version of the library I have, but I have
the following gcc compilers installed (as reported by cygcheck -s):

gcc 3.2-3
gcc-mingw   20020817-4
gcc22.95.3-10

Please direct me on how I can get this information to someone who knows
what to do with it!

Thanks much,
Richard

-- 
Richard Troy, Chief Scientist
Science Tools Corporation
[EMAIL PROTECTED], 510-567-9957, http://ScienceTools.com/



--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/




Re: GCC bug with strftime

2003-01-13 Thread Christopher Faylor
On Mon, Jan 13, 2003 at 05:46:20PM -0800, Richard Troy wrote:
I recently discovered a bug in strftime(). I downloaded a very recent copy
of cygwin and tried again, but it's still there. So, I'd like to report
it. I sent mail to the gcc-bugs list but nobody there seems to care,

Why *would* anyone in gcc care about a library problem?  I believe that
they actually mentioned that the below was a GNU extension.  But,
regardless, the problem has nothing to do with gcc.

The problem is that this call fails to return an hour:

   strftime(IT,key,%m/%d/%y %l:%M %p, brokentime);

The l% is supposed to represent a _space_ padded hour, as documented here:
http://www.gnu.org/manual/glibc-2.0.6/html_chapter/libc_17.html#SEC302

cygwin != glibc.  However, since cygwin uses newlib, and the people in
the newlib project are a cooperative bunch, maybe if you submitted a
patch, they'd consider adding it.  The mailing list is newlib at sources
dot redhat dot com.

cgf

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/




Re: GCC bug with strftime

2003-01-13 Thread Richard Troy

 I recently discovered a bug in strftime(). I downloaded a very recent copy
 of cygwin and tried again, but it's still there. So, I'd like to report
 it. I sent mail to the gcc-bugs list but nobody there seems to care,

 Why *would* anyone in gcc care about a library problem?  I believe that
 they actually mentioned that the below was a GNU extension.  But,
 regardless, the problem has nothing to do with gcc.

Doah! Yeah, glibc - what _was_ I thinking?! -smile-

 The problem is that this call fails to return an hour:
 
  strftime(IT,key,%m/%d/%y %l:%M %p, brokentime);
 
 The l% is supposed to represent a _space_ padded hour, as documented here:
 http://www.gnu.org/manual/glibc-2.0.6/html_chapter/libc_17.html#SEC302

 cygwin != glibc.  However, since cygwin uses newlib, and the people in
 the newlib project are a cooperative bunch, maybe if you submitted a
 patch, they'd consider adding it.  The mailing list is newlib at sources
 dot redhat dot com.

Thanks Christopher...

Richard


 cgf

 --
 Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
 Bug reporting: http://cygwin.com/bugs.html
 Documentation: http://cygwin.com/docs.html
 FAQ:   http://cygwin.com/faq/



--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/




Re: GCC bug with strftime

2003-01-13 Thread Richard Troy


  of cygwin and tried again, but it's still there. So, I'd like to report
  it. I sent mail to the gcc-bugs list but nobody there seems to care, so I
  thought I'd mention it here.
 
  The problem is that this call fails to return an hour:
 
  strftime(IT,key,%m/%d/%y %l:%M %p, brokentime);

 hmmm...

 Are you sure that you are not passing a 'el' instead of a capital 'eye'

 it is real hard to differentiate in some typefaces

 note: python just calls the underlying 'C' strftime() implementation

 HTH

 Norman

Thanks for the thought, Norman.

The answer is yes, I have checked. The code works in my various RedHat
environments and has been for a long time. Also capital I is not what I
need; As your example illustrated, it returns a zero padded two digit
hour, but what I want/need is a non-padded hour, two or one digit,
depending. The reason I really care is because there are two programs that
have to talk to one another, one written in C and the other in Java. It
nearly doesn't matter which is which is which, they just have to agree on
the format. All was fine until I compiled the code on my cygwin
installation.

-shrug-

Richard


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/




Re: GCC bug with strftime

2003-01-13 Thread Norman Vine
Richard Troy writes:
 
 I recently discovered a bug in strftime(). I downloaded a very recent copy
 of cygwin and tried again, but it's still there. So, I'd like to report
 it. I sent mail to the gcc-bugs list but nobody there seems to care, so I
 thought I'd mention it here.
 
 The problem is that this call fails to return an hour:
 
 strftime(IT,key,%m/%d/%y %l:%M %p, brokentime);

hmmm...

Are you sure that you are not passing a 'el' instead of a capital 'eye'

it is real hard to differentiate in some typefaces

note: python just calls the underlying 'C' strftime() implementation

HTH

Norman

$ python
Python 2.2.2 (#1, Dec 31 2002, 12:24:34)
[GCC 3.2 20020927 (prerelease)] on cygwin
Type help, copyright, credits or license for more information.
 import time
 time.strftime(%m/%d/%y %l:%M %p)
'01/13/03 :25 PM'
 time.strftime(%m/%d/%y %I:%M %p)
'01/13/03 09:26 PM'



--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/