CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Timers

  1. #1
    Join Date
    Feb 2000
    Location
    Raleigh, NC USA
    Posts
    24

    Timers

    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

  2. #2
    Join Date
    May 2000
    Location
    NJ,USA
    Posts
    64

    Re: Timers

    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured