0
How long on average an i++ increment takes to be done.
In view of the answers and comments placed here: I asked this question because I have a method to send emails when a certain condition is reached.
I can’t wear something like Thread.Sleep()
so that there is no constant referral. Assuming I can’t change that condition programmatically due to the possibility that it might be physical (like a sensor being broken or something like that), I thought I’d test a counter to "simulate time". At least, it was the first thing that came to mind.
I think you could benchmark, because the results are too variant for each machine, in the case of
++
and--
is likely to be imperceptible, even using millionth of a second to calculate.– Guilherme Nascimento
I gave an answer, if you have a specific reason for the question, add, that I supplement the answer.
– Maniero
Hdeiro, I suggest you create another answer by exposing your real problem, including some relevant code snippet. There are several mechanisms in Java to deal with events and timing and you can’t know which one is best suited just for this information. Hug!
– utluiz
Search on
Scheduler
, probably what you need. Scheduling task routines, or simply sending loops.– Ilario Junior
The application is in my stage. Monday I add!
– HDeiro
@Hdeiro You can accept an answer if it solved your problem. You can vote on all the posts on the site as well. Did any help you more? Something needs to be improved?
– Maniero
I solved otherwise using Joda-time. :)
– HDeiro