mIRC Homepage
Posted By: poormillionaire $ctime - 31/03/06 02:24 PM
Quote:

$ctime(text)
Returns the number of seconds elapsed since 00:00:00 GMT, January 1, 1970 based on the date that you specify.


It would be nice to extend $ctime to 1900, what do you think?
Posted By: vexed Re: $ctime - 31/03/06 02:28 PM
Not really, since that's the date of the the Unix Epoch. I couldn't see a need for this.
Posted By: genius_at_work Re: $ctime - 31/03/06 02:58 PM
You can't just "extend" ctime (32-bit time) back farther. You'd have to go alter almost every computer on the face of the planet. 32-bit ctime will "end" at 18 Jan 2038 19:14:07. That is when all 31 numerical bits are 1s (1 bit is the sign bit, and is unused). I believe there is a 64-bit version in the works somewhere to allow ctime to continue working past its 32-bit roll-over point.

-genius_at_work
Posted By: DaveC Re: $ctime - 31/03/06 04:41 PM
omg it well be the Y2K+38 bug! :-)
Posted By: Jigsy Re: $ctime - 01/04/06 03:01 PM
This is prolly the best you could do for now ...

Code:
/vtime {
  var %x = 1900, %y = 31622400
  while (%x < 1970) {
    inc %x 1
    if ($numtok($calc(%x / 4),46) >= 2) {
      var %y = %y + 31536000
    }
    else { var %y = %y + 31622400 }
  }
  var %y = %y + $ctime
  return %y
}


I'm not sure if thats actually correct though ...

If I can be bothered I'll try improve it
Posted By: starbucks_mafia Re: $ctime - 01/04/06 06:32 PM
Extending ctime to represent dates from 1900 doesn't mean ctime would need to be 'reset' to use 0 as 1 Jan 00:00 1900 UTC. There's nothing about ctime that says it can only represent times after the UNIX epoch, there are many many implementations that already handle negative values correctly.

While mIRC currently uses a 32-bit signed integer, which wouldn't quite reach back to 1900, there's absolutely nothing stopping mIRC implementing ctime using a 64-bit signed integer and correcly handling negative values to future-proof and past-proof $ctime() once and for all (well, until 292000000000 AD at least).
Posted By: Doqnach Re: $ctime - 04/04/06 01:29 PM
win32 API actually has a __int64 struct (which is simply a struct consisting out of 2 32 bit int's) which could be used for this...
Posted By: hixxy Re: $ctime - 04/04/06 03:20 PM
I don't think it's worth the bother then. Having to change the code again in 291999997994 years will be a pain in the ass.
Posted By: DaveC Re: $ctime - 08/04/06 09:16 AM
too right, that would annoy me greatly!
© mIRC Discussion Forums