• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Y2038 C/C++ bug
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: applescript-users digest, Vol 3 #1248 - 13 msgs (From: "Marc S.A. Glasgow" <email@hidden>)
 >Re: Y2038 C/C++ bug (From: Emmanuel <email@hidden>)

  • Prev by Date: Re: Frontmost app
  • Next by Date: Re: Mail.app - Delete mailbox does not work?
  • Previous by thread: Re: Y2038 C/C++ bug
  • Next by thread: SE2: Contextual Menu click buglet
  • Index(es):
    • Date
    • Thread