Click to See Complete Forum and Search --> : Timers


jermaine
October 2nd, 2000, 04:49 PM
Hi everyone,

I am writing a console application using JDK 1.1.17 that requires me to read through a large number of integer values and perform some math on them to adjus them according to new data. Part of the information that I'm supposed to give as the program's output is the amount of time that it takes me to do all this (in seconds). I've never used any time methods in java before, so I'm at a complete loss. How can either:

a.) Start a timer at the begining of the program and stop it again later, then take the difference in the times; or

b.) Take the local time when I start the program, then take it again when I finish, and take the difference between the two to produce the total elapsed time.

Thanks!

At Your Service,

Jermaine the Novice

vasgaddam
October 3rd, 2000, 08:41 AM
HI, there are two ways to do it.
> U can take the system time by using System.currentTimeMillis() which will return a long. Use this function where ever u want the current time then take the difference.
>> U can use thread technology also..

Sreeni
#IF this post is valid to u, then don't forget to rate it.