Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


threads to get the elapsed time

Posted on 2006-10-23
Medium Priority
Last Modified: 2010-03-31

Can anyone write a piece of code where thread sleeps every 5 minutes. calculate elapsed time (each time get the system time and compare with the last value )(hours, minutes,seconds)
Question by:cutie_smily
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 92

Accepted Solution

objects earned 600 total points
ID: 17792627
elapsed time of what?

Author Comment

ID: 17792752

get system time every 5 minutes and calculate the difference in time from the last time you got the system date
LVL 92

Expert Comment

ID: 17792797
why wouldn't it be 5 minutes :)

long a = System.currentTimeInMillis();
long b = System.currentTimeInMillis();

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 17792819

for instance now the system time is 8:55:40

after 5 minutes

system time will be 9:00:40

time diffrence= 5 minutes.

a program to calculate time difference..

Assisted Solution

shinobun earned 150 total points
ID: 17793223
long a = System.currentTimeInMillis();
long b = System.currentTimeInMillis();

b - a = the elapsed milliseconds.  You can calculate from there.
LVL 92

Expert Comment

ID: 17793257
> use whjat i posted above

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question