mIRC Home    About    Download    Register    News    Help

Print Thread
#233570 25/08/11 05:00 AM
Joined: Aug 2011
Posts: 21
T
ThatGuy Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Aug 2011
Posts: 21
I have discovered there is a error possible bug in mIRC code that prevents $ctime from calculating anything before 1970 and anything past 2037.
I figure 1970 is an obvious limit because it says in the help file it calculates between 1979 1970 and the date indicated.

Is there a way to 'unlock' the limitation to get a ctime before 1970 or after 2037?

Last edited by ThatGuy; 25/08/11 06:43 AM.
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
It's not really a bug, just a limitation caused by mIRC using a 32-bit unsigned integer internally to represent the ctime value. It can certainly be fixed, changing to a signed 64-bit integer would put the limit beyond the lifespan of the universe in either direction.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Aug 2011
Posts: 21
T
ThatGuy Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Aug 2011
Posts: 21
Originally Posted By: starbucks_mafia
It can certainly be fixed, changing to a signed 64-bit integer would put the limit beyond the lifespan of the universe in either direction.

I figure I would need to (once again) re-install my Operating System to a 64 bit version in order to accomplish this suggestion?

Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Not necessarily, modern 32-bit environments will generally have 64-bit integer types available. Having taken a brief look at MSDN it appears there are 64-bit-supporting ctime functions available for all modern versions of Windows. However it appears they still only support positive values.

Of course there's only one person who can say for sure on the practicality of any of this...

Last edited by starbucks_mafia; 25/08/11 06:33 PM.

Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Keep in mind that very many other software systems share this same "flaw". It's a similar issue to the infamous "Y2K" bug (see here). Of course, this time we know about the issue decades in advance, and it's likely by the time 2037 rolls around we won't be using 32bit integers to represent time anymore anyway. I'm not sure there's a need for this just yet though-- if you really need to calculate dates between now and 2038 onwards, you might want to look at just doing simple math with years and months for an approximation, or write a dll to make use of the 64bit time functions mentioned above.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Jun 2004
Posts: 8
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
Joined: Jun 2004
Posts: 8
Reminds me of #116045.


Link Copied to Clipboard