This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: mktime loop
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Mon, 13 May 2013 17:36:51 +0200
- Subject: Re: mktime loop
- References: <5244063b734b165baf34bdebaff0aca5 at denis-excoffier dot org>
- Reply-to: cygwin at cygwin dot com
On May 13 09:08, Denis Excoffier wrote:
> Hello,
>
> The following program (see below) is working properly under plain
> 1.7.18. With all the snapshots afterwards (including
> the current one 20130508), it fails after day=19, looping forever
> (it seems). I use XP.
>
> Regards,
>
> Denis Excoffier.
>
> % cat foo.c
> #include <stdio.h>
> #include <time.h>
>
> int
> main ()
> {
> int day;
> // date --date='@2147483647' +%Y-%m-%d gives 2038-01-19
> for ( day = 1 ; day <= 31 ; ++day ) {
> struct tm tm;
> time_t now;
> tm.tm_year = 2038 - 1900;
> tm.tm_mon = 1 - 1;
> tm.tm_mday = day; // 19, 20
> tm.tm_hour = 0;
> tm.tm_min = 0;
> tm.tm_sec = 0;
> now = mktime (&tm);
> fprintf (stderr, "day=%d\n", day);
> };
> return 0;
> }
Thanks for the testcase. This looks like the new BSD code I added
lately assumes that the datatype time_t is 8 bytes, not 4 byte as on 32
bit Cygwin. That's just a hunch I take from the fact that your testcase
works fine on 64 bit Cygwin and only hangs on 32 bit Cygwin. Oh well.
I'll investigate further...
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer 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