• 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: Broken date math on AppleScript 2.0
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Broken date math on AppleScript 2.0


  • Subject: Re: Broken date math on AppleScript 2.0
  • From: Philip Aker <email@hidden>
  • Date: Fri, 15 Feb 2008 20:31:42 -0800

On 2008-02-15, at 16:25:43, Scott Babcock wrote:

It appears that date math on AppleScript 2.0 (shipped with Leopard) is not working correctly with large values.

If you have an integer whose value exceeds 0x1FFFFFFF, and you try to add or subtract this integer from a date, you will not get the expected value.

This integer equates to 17 years, 3 weeks, 4 days, 18 hours, 31 seconds. (This assumes 52 weeks in a year - leap years are not considered).

Further pathology: The bogus value you get is processor-dependant.
Even further pathology: The time component of the bogus result changes with every run.


set now to date "Friday, February 15, 2008 3:07:35 PM"
set sub to (2 ^ 29) - 1 --> 5.36870911E+8
set den to (now - sub)
--> date "Sunday, February 10, 1991 8:19:04 PM"

set sub to sub + 1 --> 5.36870912E+8
set den to (now - sub)
--> Intel: date "Thursday, June 16, 2005 6:55:28 PM" (or so...)
--> PPC: date "Tuesday, January 22, 2008 9:48:30 PM" (or so...)

I opened a bug for this. We'll see how soon Apple can produce a fix.

Thanks a lot for mentioning this Scott. I'll be watching for it at C level and let you know if it's reproducible there.



Philip Aker echo email@hidden@nl | tr a-z@. p-za-o.@



_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >Broken date math on AppleScript 2.0 (From: Scott Babcock <email@hidden>)

  • Prev by Date: Re: Sound Effects
  • Next by Date: iCal and broken 'event whose' problem
  • Previous by thread: Re: Broken date math on AppleScript 2.0
  • Next by thread: Re: Broken date math on AppleScript 2.0
  • Index(es):
    • Date
    • Thread