Hi-Res Timer / Exact time stamps

D

David Reitter

Hi,

is there a way to get a high-resolution timer (10th of seconds will
do) in VBA in Excel under OS X?
Under Windows, getTickCount() seems to be an option, but I can't find
an appropriate function for VBA on OS X.

Many thanks
Dave
 
J

JE McGimpsey

is there a way to get a high-resolution timer (10th of seconds will
do) in VBA in Excel under OS X?
Under Windows, getTickCount() seems to be an option, but I can't find
an appropriate function for VBA on OS X.

There's no native VBA sub-second timer in MacXL.

You can use the MacScript() method to call an OSAX like GetMilliSec:

http://osaxen.com/getmillisec.html

Call as

Dim dTime1 As Double
Time1 = MacScript("GetMilliSec")


On the downside, the latency in calling the Applescript function is
significant - 400 to 800 ms, so you'll need to tare the results
(subtract the time of calling the osax). I find when I run the above
with no other apps open, my variance in tare results is within 50
milliseconds, which will give you your 0.1 s resolution, but when other
apps are running, the variance increases dramatically.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top