What do you wish to calculate? If you calculate
GetAsTimeStamp ( Get ( CurrentTimeUTCMilliseconds ) / 1000 )
the result will look something like:
Thank you for your answer.
Yes I used that from the FMP Help, but, would you mean that I should use the 3 digits on the right (in your example 150) as milliseconds count ?
Yes that is the milliseconds, but if you use
GetAsNumber ( Get ( CurrentTimeUTCMilliseconds ) )
the full number is milliseconds ... only it is just a lot milliseconds, but if you do calculations with them it eassier
Looks like you're better served with "pause/Resume Script [t]", you can use 1/50 as t without problems.
the "pause/Resume Script [t]" sounds very interesting.
You mean that a script like...
- Set Field [TimeSelected; "1 / 25"]
- Set Field [ShowTarget; "123456"]
- Pause/Resume Script [Duration (seconds): TimeSelected]
- Set Field [ShowTarget; ""]
will be accurate for displaying the target for 1/25 of a second (or any value for the TimeSelected field)
Is that so easy !? amazing !!!... and I was struggling with the Get ( CurrentTimeUTCMilliseconds ) function !!!!
Thank You !
Hmmm... not so fast.... it all depends on your hardware, I guess.
Try the attached test I quickly assembled.
With the pause/resume script thing you can only go that far (Method 1).
Method 2 is better, but still hardware-dependent (mostly video card I guess).
Make sure you have no other FM windows opened (like Data viewer or Manage scripts).
Every time you hit the Show value buttons, look at the indication you get in the footer.
PS I tried with Method 3, using Hide when instead of Method 2's conditional formatting, but there's no difference, maybe a bit slower.
TimingTest.fmp12.zip 68.2 K
Very nice !
Method 1 shows a slower timing compared to selected timing (for example selecting 1/25 gives me around 72 msecs +/- 4 msecs).
Method 2 and 3 are pretty consistent with a difference of only 1 or 2 msecs and both works fine on my MacBookPro 17" (Mid 2010) giving correct timing (for example selecting 1/25 gives me a consistent response of 40-42 msecs, which is just perfect since 2 msecs are really not an issue).
I tested your file also on iMac 21" (Middle 2013) and Method 1 gives quite different results but Method 2 and 3 are very consistent with the above results obtained on MacBookPro.
I have no idea how much Method 2 or 3 would be hardware-dependant on different computers (Macs or PCs), maybe not so much ?
Or maybe the GetAsNumber ( Get ( CurrentTimeUTCMilliseconds ) ) would be less hardware-dependant since it measure real time?
Thank You for your efforts :-)
Any further calc you add, like getAsNumber(), will interfere - when even slightly - with the precision. It's not necessary, as the function result you're evaluating already outputs a numeric value.
Conditional formatting is influenced by the position of the element on the layout: elements in the back are evaluated and rendered before those in front, but that only matters seriously when you have hundreds of layout elements. However, a further test would be to isolate each method on its own layout with nothing else around. Even deleting header and footer can help, especially if your solution is used in a client-server environment.
In order to demonstrate that method 2 is slightly faster than method 3, you can do the following:
- add 1/200 to the value list and select it.
- from the conditional formatting of the gValue field in Method 2, remove the color, leave just the setting of the font size to 500.
- change in both scripts (DisplayValue2 and DisplayValue3) the 4th line (for precision) to
Set Variable [ $stopover ; Value: 1000 * Evaluate($fraction) - 1 ]
On my MacBookPro 15" retina, late 2013, I was able to get 7 msec with method 2 say every 7 clicks of the button.
Method 3 never achieved 7 ms, only 8, sometimes. Really pushing it
I did and I confirm what you said
I am already implementing suggestions from your example file (using Method 2) into my solution (getting a bit busy since there are some 50 options to choose from (random generated numbers and letters, standardized testing target, and also shapes).
Your help was very useful to me.
Thank You again for your time and efforts,
don't tell me you're in ophthalmology