• 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: "Mark J. Reed" <email@hidden>
  • Date: Tue, 19 Feb 2008 07:35:34 -0500

On Feb 18, 2008 6:41 PM, deivy petrescu <email@hidden> wrote:
> I do not know if it is date or integer problem.

Arguably a date problem.  The trouble is that Applescript won't coerce
a date value into a floating point value to do math on it.   The magic
number, as discussed earlier in this thread, is 2^29 - 1, or
536,870,911; you've just hit on a couple of creative ways of reaching
it.  (Note that the time units are defined in terms of seconds, so
that "days" = 86400).  If you do this:

current date + 536870911

then AppleScript does integer math and gets a sensible result.  But if
you do this instead:

current date + 536870912

then the second number is too big to represent in an integer, so it
becomes a float, and things break down.  I'm not sure exactly how -
maybe it's interpreting the floating-point bit pattern as an integer,
or something.  I consistently get 2 days + 10 hours (208,800 seconds)
in the future out of the above expression.

--
Mark J. Reed <email@hidden>
 _______________________________________________
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

  • Follow-Ups:
    • Re: Broken date math on AppleScript 2.0
      • From: deivy petrescu <email@hidden>
References: 
 >Broken date math on AppleScript 2.0 (From: Scott Babcock <email@hidden>)
 >Re: Broken date math on AppleScript 2.0 (From: deivy petrescu <email@hidden>)

  • Prev by Date: Re: Updating records in Address Book
  • Next by Date: Calling a variable from multiple scripts
  • 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