2038 Problem

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2005
Posts: 466
Reputation: winbatch is on a distinguished road 
Solved Threads: 18
winbatch's Avatar
winbatch winbatch is offline Offline
Posting Pro in Training

2038 Problem

 
0
  #1
May 26th, 2005
Hi,
After completing my Date class, I realize that I am suffering from the 2038 problem. (As described here-> http://pw1.netcom.com/~rogermw/Y2038.html). Does anyone know which libraries (or which code) I need to switch to on *nix systems to overcome this? (I know windows has someting like mktime64 (instead of mktime).

Google returns lots of info about the problem, nothing really about the solution...

Thanks,
Winbatch
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,335
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 235
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: 2038 Problem

 
0
  #2
May 26th, 2005
Could you describe your problem with this in more detail?
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 466
Reputation: winbatch is on a distinguished road 
Solved Threads: 18
winbatch's Avatar
winbatch winbatch is offline Offline
Posting Pro in Training

Re: 2038 Problem

 
0
  #3
May 26th, 2005
Sure, basically I have a date class that I wrote which wraps time_t. time_t and its associated functions mktime, localtime, etc do not function after January 19, 2038. (This is a known issue and is not related to my specific class). Attempts to use dates greater than that cause undefined behavior. (Basically attempting to go over the maximum value of an int).

My question was whether there are replacements for time_t (standard C++ only) that can deal with this. (I'm covered on windows since they created a time_64)
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,335
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 235
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: 2038 Problem

 
0
  #4
May 26th, 2005
From some bits I'd read a while ago, that I haven't been able to find again, it's a problem for the generated executable -- not necessarily the source code. For example, in 2011 the world runs 64-bit workstations: you recompile with a 64-bit unsigned int-based time_t and you're fine for a good while. Running today's application for the next 33 years, however, would be problematic.

But unfortunately, I haven't dug up any current non-standard replacement functions.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 466
Reputation: winbatch is on a distinguished road 
Solved Threads: 18
winbatch's Avatar
winbatch winbatch is offline Offline
Posting Pro in Training

Re: 2038 Problem

 
0
  #5
May 26th, 2005
Right - basically I'm looking to see if this:

64-bit unsigned int-based time_t

exists already on unix. If so, I would compile with it now..
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,335
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 235
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: 2038 Problem

 
0
  #6
May 26th, 2005
Which flavor of Unix (not that my searches will be any better than yours)? And what target processor?
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 466
Reputation: winbatch is on a distinguished road 
Solved Threads: 18
winbatch's Avatar
winbatch winbatch is offline Offline
Posting Pro in Training

Re: 2038 Problem

 
0
  #7
May 27th, 2005
SunOS ... 5.8 Generic_108528-14 sun4u sparc SUNW,Sun-Fire-280R

(Basically, solaris 8), using Forte 7 compiler.
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 32
Reputation: sinrtb is an unknown quantity at this point 
Solved Threads: 0
sinrtb sinrtb is offline Offline
Light Poster

Re: 2038 Problem

 
0
  #8
May 27th, 2005
Originally Posted by winbatch
SunOS ... 5.8 Generic_108528-14 sun4u sparc SUNW,Sun-Fire-280R

(Basically, solaris 8), using Forte 7 compiler.
you should be able to write an algorithm for this problem. the problem does not lie in the executeable it lies in the class you are using, all it does is takes the amount of seconds since sometime in 1969 and using division seperates it into days years and dates. because this is seconds the MAX_INT_SIZE is reached fairly quickly. but if you were to take the raw data and and find a away to see if it "rolled" you can just add the return value to the max int value in an array form then do all your calculations with that number. there is a big number factorial calculator that i belive does this on this site.
Just my thoughts.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 466
Reputation: winbatch is on a distinguished road 
Solved Threads: 18
winbatch's Avatar
winbatch winbatch is offline Offline
Posting Pro in Training

Re: 2038 Problem

 
0
  #9
May 27th, 2005
I would prefer not to have to rewrite all of the calculations performed by mktime, localtime, etc. just to accomplish this....

I've already fixed my code on windows by simply using __time_64_t instead of the time_t. I'm just looking for a unix equivalent.
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,335
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 235
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: 2038 Problem

 
0
  #10
May 27th, 2005
Originally Posted by sinrtb
all it does is takes the amount of seconds since sometime in 1969 and using division seperates it into days years and dates.
That sounds a little naïve; dates and times do have their many little issues.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC