• 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
Timing is everything [Was: Re: Yosemite decimal number conversion error]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Timing is everything [Was: Re: Yosemite decimal number conversion error]


  • Subject: Timing is everything [Was: Re: Yosemite decimal number conversion error]
  • From: Shane Stanley <email@hidden>
  • Date: Wed, 29 Oct 2014 17:33:58 +1100

Looking at Takaaki Naganoya's Web site reminded me of a neat hint to do with timing scripts. Typically people do things like:

set a1Dat to current date
-- do stuff
set b1Dat to current date
set c1Dat to b1Dat - a1Dat

for rough timings. That's fine, but sometimes you want better than to the nearest second. 

In Yosemite, you can include a 'use framework "Foundation"' statement and then use:

set a1Dat to current application's NSDate's timeIntervalSinceReferenceDate()
-- do stuff
set b1Dat to current application's NSDate's timeIntervalSinceReferenceDate()
set c1Dat to b1Dat - a1Dat

Not only are the commands themselves a bit quicker, but the result includes fractions of a second.

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
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: Timing is everything [Was: Re: Yosemite decimal number conversion error]
      • From: Takaaki Naganoya <email@hidden>
References: 
 >Yosemite decimal number conversion error (From: Takaaki Naganoya <email@hidden>)
 >Re: Yosemite decimal number conversion error (From: Shane Stanley <email@hidden>)
 >Re: Yosemite decimal number conversion error (From: Takaaki Naganoya <email@hidden>)

  • Prev by Date: Re: Yosemite decimal number conversion error
  • Next by Date: Re: Yosemite decimal number conversion error
  • Previous by thread: Re: Yosemite decimal number conversion error
  • Next by thread: Re: Timing is everything [Was: Re: Yosemite decimal number conversion error]
  • Index(es):
    • Date
    • Thread