Re: Y2038 C/C++ bug
Re: Y2038 C/C++ bug
- Subject: Re: Y2038 C/C++ bug
- From: John W Baxter <email@hidden>
- Date: Thu, 16 Jan 2003 22:52:23 -0800
- Envelope-to: email@hidden
At 12:50 +0100 1/16/2003, Emmanuel wrote:
>
>The next time issue that I'm aware of should be the Y2038C/C++ bug.
>
>See my white paper on the subject at:
>
>http://www.cyberpoet.net/consult/wp.html
>
>
Is this related to the bug that you say?
>
>
set x to date "Monday, January 1, 2035 12:00:00 AM"
>
set x to x + 366 * 86400 (repeated 6 times)
>
>
-->
>
date "Wednesday, January 2, 2036 12:00:00 AM"
>
date "Friday, January 2, 2037 12:00:00 AM"
>
date "Sunday, January 3, 2038 12:00:00 AM"
>
date "Tuesday, January 4, 2039 12:00:00 AM"
>
date "Thursday, January 5, 2040 12:00:00 AM"
>
date "Tuesday, November 29, 1904 5:31:44 PM"
>
>
Emmanuel
Well, yes...they both relate to the end of time. In Unix' case, the end of
31-bit time starting at the beginning of 1970; in archaic Mac's case the
end of 32 bit time starting at the beginning of 1904.
However, Mac time hasn't been unsigned 32 bits for many years...it
(including AppleScript's) is a signed 64 bit integer (let the OS worry
about the little detail that the clocks are still 32 bit at least for now)
with zero still at the beginning of 1904.
It's dispiriting to see the above result, since AppleScript's date type
(<<class ldt >>) has been carrying around 32 zero bits waiting anxiously
for a 1 to show up since the beginning of (publicly-seen) AppleScript.
But, sadly, c'est vrai.
I hate to thing that Apple is doing a 32 bit add into a 64 bit
value...maybe just the conversion to text is wrong. Nope, Apple can't
carry...from Script Debugger's AEPrint mode for the result window:
[
ldt ($00000000F84B6100$),
ldt ($00000000FA2DE600$),
ldt ($00000000FC106B00$),
ldt ($00000000FDF2F000$),
ldt ($00000000FFD57500$),
ldt ($0000000001B7FA00$)
]
where the script was
set x to date "Monday, January 1, 2035 0:00:00"
set answer to {}
repeat 6 times
set x to x + 366 * 86400
set end of answer to x
end repeat
answer
Apple does have a year or two to fix it, and carrying isn't all that hard.
--John
--
John Baxter email@hidden Port Ludlow, WA, USA
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.