Sign in to follow this  
ccdubs

Displaying Timer Onscreen

Recommended Posts

Hi all,

I have an application that requires timing of a user acitvated event. The event will be triggered from the field and relayed to DF via Modbus comms. The same is true for when the event finishes.

I need for DF to time the event as accurately as possible (ignore comms delays, etc) and to display the elapsed time on screen. This is easy by using systime()-myvar where myvar is set at the start of the event. The problem is trying to display the time on screen with a resolution of .01 s. As the page refresh rate is not as fast, the number doesn't change appropriately, I can get the 0.1 resolution to work OK.

Is there any way to display effectively at this accuracy? I have set up a system where the .01 number is generated randomly and it doesn't look too bad but it would be better to have it directly linked to the timed value.

I'm also concerned that when I add some graphics to the page and further sequences that the timer update will get worse.

Many thanks.

Share this post


Link to post
Share on other sites

If you are timing between two events, I'm not sure why you are using systime() in your display. You should instead use two variables, one that is set to systime() at the start, and the other which is set to systime() at the end. Lets say they are call "st" and "et". If you want the screen to display the elapsed time after start, but then the final total time once stepped, you can use iif(). First, when you start do:

st = systime()

et = 0

When you stop, do:

et = systime()

In your onscreen display do:

iif(et == 0,systime() - st, et - st)

this causes it to display elapsed time (systime() - st) if the end time doesn't exist yet, and the total time if it does.

Share this post


Link to post
Share on other sites

Thanks Guru,

This is essentially what I am doing apart from not using an inline IF.

The problem still exists that I can't display the timer effectively with 10ths of a second resolution. This is due to the page not refreshing fast enough so the 10ths digit doesn't change continuously like if you were looking at a stopwatch.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this