Cronometro va troppo lento

Salve,
non riesco a capire come mai il mio cronometro vada lento; facendo un confronto con un cronometro online.
Saluti
Nicola

Salve,
ho modificato il codice, ma non riesco a capire perchè la lentezza del cronometro rimane; anche se ho impostato clock.interval = 1
Saluti
Nicola

Clock interval = 1?
That is a terrible thing to do. 1 Means one millisecond to complete your timer event. No super phone can do that!
Make it at least 100.
Cheers, Ghica

Grazie Ghica per il tuo consiglio.
Saluti
Nicola

But does it work now? I guess so, because you have marked it solved…
Cheers Ghica.

Lo credevo, invece non funziona. Ho impostato l’intervallo del clock a 100, ma va lentissimo; quindi l’ho rimesso a 1…a questo punto va un pò più veloce…ma resta comunque lento se faccio il confronto con questo cronometro online:
http://www.cronometro.co/
Saluti
Nicola

Mi dispiace!
Could you upload your .aia, so that I can try?
Cheers, Ghica

Ti ringrazio per il tuo aiuto prezioso e ti allego il file.aia.
Saluti
Nicola
Cronometro_HA_Notifier_Clock_Files_copy (2).aia (75.9 KB)

Hi Nicola,
It was rather clear what the problem of your app is, look at this quote of the documentation:
TimerInterval

Specifies the interval between subsequent Timer events.

Note : Drift may occur over time and that the system may not honor the timing specified here if the app or another process on the phone is busy.

Therefore, your method of just adding one unit every time the timer fires can never work. And as I said, a timer interval of 1 millisecond is impossible for AI to keep up with. So, what to do?
I modified your app to take the real start time and interval time, subtract those and display the result as minutes, seconds and tenth of milliseconds.
I have done this several times before, but each time it gives me problems. Anyway, this one works, although there may be clever people who can calculate better that I can.

You always want double digits, a small procedure does that:
blocks (54)

Also, I split out the tenth of seconds calculation, for clarity.

I did not do anything to the pause, or storing results that you made. I assume you can do that now.

One other thing: I do not have a very small phone, but still, your design does not fit. So, to see at least the chronometer, I made your nice picture invisible. But I think it would be better to have a portrait layout, with maybe slightly smaller text.
Finally, the updated .aia:
Cronometro_HA_Notifier_Clock_Files_3.aia (76.7 KB)

Let me know if this helps you.
Cheers, Ghica.

Ciao Ghica,
il tuo metodo di prendere l’ora di inizio insieme all’intervallo in tempo reale; sottraendo e visualizzando il risultato in minuti, secondi e decimi…funziona alla grande; ma io ho aggiunto un controllo che mi metta a “0” i secondi nel momento in cui essi corrispondessero a 59…ma dopo averlo azzerato…continua giustamente il suo conteggio :unamused:
Saluti
Nicola

Hi Nicola,
Stupid mistake!
Make the set Lb_secondi like this:


Now it should work. Of course I did not have the patience to keep testing past one minute…
Sorry!
Cheers, Ghica

Ciao Ghica,
grazie ancora per la tua disponibilità; cmq funziona tutto bene. Colgo l’occasione nell’augurare una Serena Pasqua a te e tutti i Power User’s.
Saluti
Nicola

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.