Forums Register Login

How to get the elapsed Thread wait time?

+Pie Number of slices to send: Send
Hi,

If my thread sleeps for 100 seconds.How can i get the details of time elapsed at a given point of time?
Is there any java API to get it?

Edward
+Pie Number of slices to send: Send
What is going to be observing the sleeping Thread?

You can use java.lang.System.currentTimeMillis() to set a long variable timestamp just before starting to sleep, but who will be looking at that?

Is this just a matter of curiosity or do you really have a need?

Bill
+Pie Number of slices to send: Send
Bill thanks for reply..

I need it in some of my work . i need to get the elapsed time and i have to set some conditions based on the elapsed time , so that the resumed thread has to perform some additional tasks.I am able to achive it using "java.lang.System.currentTimeMillis() " .. just want to know weather there is any method that will return it

Thanks

Edward
Look! I laid an egg! Why does it smell like that? Tiny ad, does this smell weird to you?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1926 times.
Similar Threads
addition and subtraction of time
Difference between sleep(),wait() and wait(long) methds
Simple - Hourglass
url timeout
wait(long timeout)
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 02:32:31.