* GCC bug with strftime
@ 2003-01-14 3:33 Richard Troy
2003-01-14 3:58 ` Christopher Faylor
2003-01-14 6:16 ` Norman Vine
0 siblings, 2 replies; 7+ messages in thread
From: Richard Troy @ 2003-01-14 3:33 UTC (permalink / raw)
To: cygwin
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
gcc2 2.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
rtroy@ScienceTools.com, 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/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: GCC bug with strftime
2003-01-14 3:33 GCC bug with strftime Richard Troy
@ 2003-01-14 3:58 ` Christopher Faylor
2003-01-14 5:55 ` Richard Troy
2003-01-14 6:16 ` Norman Vine
1 sibling, 1 reply; 7+ messages in thread
From: Christopher Faylor @ 2003-01-14 3:58 UTC (permalink / raw)
To: cygwin
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/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: GCC bug with strftime
2003-01-14 3:58 ` Christopher Faylor
@ 2003-01-14 5:55 ` Richard Troy
0 siblings, 0 replies; 7+ messages in thread
From: Richard Troy @ 2003-01-14 5:55 UTC (permalink / raw)
To: cygwin
> >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/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: GCC bug with strftime
2003-01-14 6:16 ` Norman Vine
@ 2003-01-14 5:55 ` Richard Troy
2003-01-14 10:01 ` Corinna Vinschen
0 siblings, 1 reply; 7+ messages in thread
From: Richard Troy @ 2003-01-14 5:55 UTC (permalink / raw)
To: Norman Vine; +Cc: Cygwin
> > 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/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: GCC bug with strftime
2003-01-14 3:33 GCC bug with strftime Richard Troy
2003-01-14 3:58 ` Christopher Faylor
@ 2003-01-14 6:16 ` Norman Vine
2003-01-14 5:55 ` Richard Troy
1 sibling, 1 reply; 7+ messages in thread
From: Norman Vine @ 2003-01-14 6:16 UTC (permalink / raw)
To: Richard Troy; +Cc: Cygwin
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/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: GCC bug with strftime
2003-01-14 5:55 ` Richard Troy
@ 2003-01-14 10:01 ` Corinna Vinschen
2003-01-14 12:56 ` Richard Troy
0 siblings, 1 reply; 7+ messages in thread
From: Corinna Vinschen @ 2003-01-14 10:01 UTC (permalink / raw)
To: Cygwin
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
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Developer mailto:cygwin@cygwin.com
Red Hat, Inc.
--
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/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: GCC bug with strftime
2003-01-14 10:01 ` Corinna Vinschen
@ 2003-01-14 12:56 ` Richard Troy
0 siblings, 0 replies; 7+ messages in thread
From: Richard Troy @ 2003-01-14 12:56 UTC (permalink / raw)
To: Cygwin
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
rtroy@ScienceTools.com, 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 <corinna-cygwin@cygwin.com>
> Reply-To: cygwin@cygwin.com
> To: Cygwin <cygwin@cygwin.com>
> 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/
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2003-01-14 9:11 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-14 3:33 GCC bug with strftime Richard Troy
2003-01-14 3:58 ` Christopher Faylor
2003-01-14 5:55 ` Richard Troy
2003-01-14 6:16 ` Norman Vine
2003-01-14 5:55 ` Richard Troy
2003-01-14 10:01 ` Corinna Vinschen
2003-01-14 12:56 ` Richard Troy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).