K
kvnsmnsn
I've been looking at classes <Time>, <Date>, and <Calendar>, trying to
figure out how to time how long it takes my program to execute, but
without any luck. What I want to do is store a time value at the be-
ginning of my program, and then store a time value at the end of my
program, and then at the end of my program subtract the two values and
come up with how many milliseconds passed while the program was exe-
cuting.
For a bit I thought I could simply call the <getTime()> method of
class <Date> twice to accomplish this, since that method is supposed
to give the number of milliseconds transpired since 1 January 1970,
but no matter how long it takes for my program to run when I subtract
the two values I always get zero.
Does anyone know what I can do to time my Java program? Any informa-
tion anyone can give me would be greatly appreciated.
---Kevin Simonson
figure out how to time how long it takes my program to execute, but
without any luck. What I want to do is store a time value at the be-
ginning of my program, and then store a time value at the end of my
program, and then at the end of my program subtract the two values and
come up with how many milliseconds passed while the program was exe-
cuting.
For a bit I thought I could simply call the <getTime()> method of
class <Date> twice to accomplish this, since that method is supposed
to give the number of milliseconds transpired since 1 January 1970,
but no matter how long it takes for my program to run when I subtract
the two values I always get zero.
Does anyone know what I can do to time my Java program? Any informa-
tion anyone can give me would be greatly appreciated.
---Kevin Simonson