* strftime trouble with %z
@ 2011-04-14 14:20 Peter Rosin
2011-04-18 19:33 ` Corinna Vinschen
0 siblings, 1 reply; 3+ messages in thread
From: Peter Rosin @ 2011-04-14 14:20 UTC (permalink / raw)
To: cygwin
Hi!
I'm getting somewhat troublesome output from the below STC.
It seems as if gmtime mucks with something, or that
localtime is not filling in everything it needs to?
------------------8<---(zone.c)---------
#include <stdio.h>
#include <time.h>
int main(void)
{
char zone[6];
struct tm *tm;
time_t now = time(NULL);
tm = localtime(&now);
strftime(zone, sizeof(zone), "%z", tm);
printf("%s %d %d\n", zone, timezone, tm->tm_isdst);
tm = localtime(&now);
strftime(zone, sizeof(zone), "%z", tm);
printf("%s %d %d\n", zone, timezone, tm->tm_isdst);
tm = gmtime(&now);
tm = localtime(&now);
strftime(zone, sizeof(zone), "%z", tm);
printf("%s %d %d\n", zone, timezone, tm->tm_isdst);
return 0;
}
------------------8<--------------------
I expect three equal lines, e.g.
+0200 -3600 1
+0200 -3600 1
+0200 -3600 1
but I get this on Cygwin:
+0200 -3600 1
+0200 -3600 1
+0000 -3600 1
$ cygcheck -c gcc4 cygwin
Cygwin Package Information
Package Version Status
cygwin 1.7.9-1 OK
gcc4 4.3.4-4 OK
FWIW, I have tested the STC on Linux and Solaris 10 and they
behave as I expected...
Cheers,
Peter
--
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: strftime trouble with %z
2011-04-14 14:20 strftime trouble with %z Peter Rosin
@ 2011-04-18 19:33 ` Corinna Vinschen
2011-04-18 20:03 ` Peter Rosin
0 siblings, 1 reply; 3+ messages in thread
From: Corinna Vinschen @ 2011-04-18 19:33 UTC (permalink / raw)
To: cygwin
On Apr 14 11:09, Peter Rosin wrote:
> Hi!
>
> I'm getting somewhat troublesome output from the below STC.
> It seems as if gmtime mucks with something, or that
> localtime is not filling in everything it needs to?
Thanks for the testcase!
Actually gmtime mucks with something. It changes global timezone
information for no good reason. I fixed that in CVS.
Thanks for the report,
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
--
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: strftime trouble with %z
2011-04-18 19:33 ` Corinna Vinschen
@ 2011-04-18 20:03 ` Peter Rosin
0 siblings, 0 replies; 3+ messages in thread
From: Peter Rosin @ 2011-04-18 20:03 UTC (permalink / raw)
To: cygwin
Den 2011-04-18 21:13 skrev Corinna Vinschen:
> On Apr 14 11:09, Peter Rosin wrote:
>> Hi!
>>
>> I'm getting somewhat troublesome output from the below STC.
>> It seems as if gmtime mucks with something, or that
>> localtime is not filling in everything it needs to?
>
> Thanks for the testcase!
>
> Actually gmtime mucks with something. It changes global timezone
> information for no good reason. I fixed that in CVS.
I'm looking forward to the next snapshot!
> Thanks for the report,
> Corinna
Thanks for the fix,
Peter
--
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-04-18 19:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-14 14:20 strftime trouble with %z Peter Rosin
2011-04-18 19:33 ` Corinna Vinschen
2011-04-18 20:03 ` Peter Rosin
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).