• 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: Why is a-b not equal to ((source of a) -b) ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is a-b not equal to ((source of a) -b) ?


  • Subject: Re: Why is a-b not equal to ((source of a) -b) ?
  • From: bill fancher <email@hidden>
  • Date: Mon, 2 Sep 2002 19:56:12 -0700

On Monday, September 2, 2002, at 06:26 PM, Timothy Bates wrote:

What is up here?

set ms1 to GetMilliSec
set ms2 to GetMilliSec
set ms3 to (GetMilliSec -ms2)

return {ms1:ms1, ms2:ms2, delta:ms2 - ms1, inlineDelta:ms3}

-->{ms1:7.9489387E+7, ms2:7.9489387E+7, diff:0.0, inlineDiff:7.9489387E+7}

How come subtracting a large number from the result of getmillisec (an osax
call under X 10.2) seems not to do the subtraction?

Try:

set ms1 to GetMilliSec
set ms2 to GetMilliSec
set ms3 to (GetMilliSec) - ms2

return {ms1:ms1, ms2:ms2, delta:ms2 - ms1, inlineDelta:ms3}
--> {ms1:7.926764E+6, ms2:7.926765E+6, delta:1.0, inlineDelta:0.0}

Without the parentheses, it thinks -ms2 is the target for the GetMilliSec event (I haven't verified that). inlineDelta is zero here because the third call to GetMilliSec returned the same value as the second. No problem there, since that seems to fit well with the difference of 1 we saw between calls 1 and 2. Repeated runs here show delta and inlineDelta returning either 0 or 1. Faster hardware might show 0's fairly consistently.

A general comment: a millisecond is BIG overhead for a "function call". That's the principle reason why many vanilla AS routines are faster than osax equivalents.

HTH,

--
bill
_______________________________________________
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.

  • Follow-Ups:
    • Re: Why is a-b not equal to ((source of a) -b) ?
      • From: Emmanuel <email@hidden>
    • Re: Why is a-b not equal to ((source of a) -b) ?
      • From: Timothy Bates <email@hidden>
References: 
 >Why is a-b not equal to ((source of a) -b) ? (From: Timothy Bates <email@hidden>)

  • Prev by Date: Re: Newb question (OT sig correction)
  • Next by Date: Desktop Printer Manager in OSX
  • Previous by thread: Why is a-b not equal to ((source of a) -b) ?
  • Next by thread: Re: Why is a-b not equal to ((source of a) -b) ?
  • Index(es):
    • Date
    • Thread