On 10 Sep 2016, at 1:51 PM, Christopher Stone <
email@hidden> wrote:
There's a lot of latency in a do shell script call, so that doesn't offer you much precision.
It's probably accurate to one decimal place. Running this:
set x to (do shell script "perl -e 'use Time::HiRes qw(time); print time'") as real
set y to (do shell script "perl -e 'use Time::HiRes qw(time); print time'") as real
y - x
I get ~0.03 seconds. Worse, running it repeatedly shows that any other numbers returned might as well be random. You wouldn't get much worse values using this:
set theStr to "1/1/1970"
set x to (current date) - (date theStr) + (random number from 0.0 to 0.999) - (random number from 0.0 to 0.999)
Running this:
use framework "Foundation"
set x to current application's NSDate's timeIntervalSinceReferenceDate()
set y to current application's NSDate's timeIntervalSinceReferenceDate()
y - x
I get ~1.0E-4, or about 0.0001. Importantly, running it repeatedly shows results that would almost always round to 0.0001, and certainly to a consistent three decimal places. As NSDate is only documented to deliver millisecond or better accuracy, that's probably as good as you will get using AppleScript.
And what, you ask, was the beginning of it all?
And it is this......
Existence that multiplied itself
For sheer delight of being
And plunged with numberless trillions of forms
So that it might
find
itself
innumerably
Sri Aurobindo