Skip Menu |

This queue is for tickets about the Time-y2038 CPAN distribution.

Report information
The Basics
Id: 40600
Status: stalled
Priority: 0/
Queue: Time-y2038

People
Owner: Nobody in particular
Requestors: taro.nishino [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 20081020
Fixed in: 20100216.1421_04



Subject: MS VC++ doesn't support long-long-suffix.
Dear Michael, As you know, unfortunately MS VC++ doesn't support long-long-suffix. Strictly speaking, VC++ doesn't support C99. As such, I had no choice but to do as follows: --- time64.c.org Mon Oct 20 20:23:14 2008 +++ time64.c Sun Nov 2 20:43:57 2008 @@ -68,7 +68,9 @@ /* Some numbers relating to the gregorian cycle */ static const Year years_in_gregorian_cycle = 400; #define days_in_gregorian_cycle ((365 * 400) + 100 - 4 + 1) -static const Time64_T seconds_in_gregorian_cycle = days_in_gregorian_cycle * 60LL * 60LL * 24LL; +#ifndef WIN32 + static const Time64_T seconds_in_gregorian_cycle = days_in_gregorian_cycle * 60LL * 60LL * 24LL; +#endif /* Year range we can trust the time funcitons with */ #define MAX_SAFE_YEAR 2037 @@ -431,6 +433,11 @@ int increment = (left_year > right_year) ? 1 : -1; Time64_T seconds = 0; int cycles; +#ifdef WIN32 + Time64_T LL60 = 60; + Time64_T LL24 = 24; + Time64_T seconds_in_gregorian_cycle = days_in_gregorian_cycle * LL60 * LL60 * LL24; +#endif if( left_year > 2400 ) { cycles = (left_year - 2400) / 400; So, the test is as follows: C:\temp\Time-y2038-20081020>perl Build test t\everywhere....ok t\time..........ok t\timegm........ok All tests successful. Files=3, Tests=48, 44 wallclock secs ( 0.06 usr + 0.08 sys = 0.14 CPU) Result: PASS Best regards, Taro Nishino
Subject: Re: [rt.cpan.org #40600] MS VC++ doesn't support long-long-suffix.
Date: Sun, 02 Nov 2008 17:41:11 -0800
To: bug-Time-y2038 [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
Taro Nishino via RT wrote: Show quoted text
> As you know, unfortunately MS VC++ doesn't support long-long-suffix. > Strictly speaking, VC++ doesn't support C99.
Sadly, I believe you. I also didn't realize that the LL suffix was a C99 thing. What version of MS VC++? I've tested it with VC Express 2008 on XP. -- Stabbing you in the face for your own good.
Subject: Re: [rt.cpan.org #40600] MS VC++ doesn't support long-long-suffix.
Date: Mon, 03 Nov 2008 13:26:51 +0900
To: bug-Time-y2038 [...] rt.cpan.org
From: Taro Nishino <taro.nishino [...] gmail.com>
Thanks for your reply. On Sun, 02 Nov 2008 20:41:49 -0500 "Michael G Schwern via RT" <bug-Time-y2038@rt.cpan.org> wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=40600 > > > Taro Nishino via RT wrote:
> > As you know, unfortunately MS VC++ doesn't support long-long-suffix. > > Strictly speaking, VC++ doesn't support C99.
> > Sadly, I believe you. I also didn't realize that the LL suffix was a C99 thing. > > What version of MS VC++? I've tested it with VC Express 2008 on XP. >
My compiler is MS VC++ 7.0(aka VC++ .NET). The reson why I need to use that version is because my Perl is ActivePerl Build 817, which is compiled by VC++ 6. I have Visual C++ 2005 as well, but that doesn't support backward compatibility. In fact, I have experienced serious issues using Visual C++ 2005. What's more, I don't have VC++ 6. As such, I have no choice but to use VC++ 7.0. As for VC Express 2008, I have no knowledge to refer to. But, it is in general said that MS VC++ doesn't support C99. As of C99, the LL suffix, etc. are included. Best regards, Taro Nishino
Subject: Re: [rt.cpan.org #40600] MS VC++ doesn't support long-long-suffix.
Date: Thu, 13 Nov 2008 16:39:59 +0900
To: bug-Time-y2038 [...] rt.cpan.org
From: Taro Nishino <taro.nishino [...] gmail.com>
Hi, Michael, As for as I can research, as for Visual C++ 2005 (aka VC++ 8.0), long long type would be supported. For example, the following can be compiled using VC++ 8.0: #include <stdio.h> #include "time64.h" #define days_in_gregorian_cycle ((365 * 400) + 100 - 4 + 1) static const Time64_T seconds_in_gregorian_cycle = days_in_gregorian_cycle * 60LL * 60LL * 24LL; int main(void) { printf("seconds_in_gregorian_cycle = %d\n", seconds_in_gregorian_cycle); return 0; } But, of course, this results in syntax error using VC++ 7.0. Put simply, by using the antique compilers up till VC++ 7.0, not to mention VC++ 6.0, time64.c cannot be compiled. Because of ActivePerl being compiled by VC++ 6.0 at the moment, I'd like to do as follows: --- time64.c.org Wed Nov 12 13:51:34 2008 +++ time64.c Thu Nov 13 16:22:00 2008 @@ -68,7 +68,11 @@ /* Some numbers relating to the gregorian cycle */ static const Year years_in_gregorian_cycle = 400; #define days_in_gregorian_cycle ((365 * 400) + 100 - 4 + 1) +#if defined( _MSC_VER ) && ( _MSC_VER <= 1300 ) +static const Time64_T seconds_in_gregorian_cycle = days_in_gregorian_cycle * 60I64 * 60I64 * 24I64; +#else static const Time64_T seconds_in_gregorian_cycle = days_in_gregorian_cycle * 60LL * 60LL * 24LL; +#endif /* Year range we can trust the time funcitons with */ #define MAX_SAFE_YEAR 2037 Best regards, Taro Nishino
Subject: Re: [rt.cpan.org #40600] MS VC++ doesn't support long-long-suffix.
Date: Thu, 13 Nov 2008 11:32:04 -0800
To: bug-Time-y2038 [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
Taro Nishino via RT wrote: Show quoted text
> --- time64.c.org Wed Nov 12 13:51:34 2008 > +++ time64.c Thu Nov 13 16:22:00 2008 > @@ -68,7 +68,11 @@ > /* Some numbers relating to the gregorian cycle */ > static const Year years_in_gregorian_cycle = 400; > #define days_in_gregorian_cycle ((365 * 400) + 100 - 4 + 1) > +#if defined( _MSC_VER ) && ( _MSC_VER <= 1300 ) > +static const Time64_T seconds_in_gregorian_cycle = days_in_gregorian_cycle * 60I64 * 60I64 * 24I64; > +#else > static const Time64_T seconds_in_gregorian_cycle = days_in_gregorian_cycle * 60LL * 60LL * 24LL; > +#endif
My concern is having to do this all over the place, though there's only two where I do it right now (see bin/check_max). This is my Perl impulse speaking. I guess a C programmer just sucks it up. -- 3. Not allowed to threaten anyone with black magic. -- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army http://skippyslist.com/list/
Maybe we can fix this with a macro. Perl has some code to handle this. I've added it in. Would you please try the long_long branch? http://github.com/schwern/y2038/archives/long_long