Results 1 to 3 of 3
  1. #1
    Marcus is offline Member
    Join Date
    Jun 2007
    Posts
    92
    Rep Power
    0

    Default problem with timer

    Hi, For the life of me I can't remember how to measure time between two points in the code. I remember doing it a long time ago, where you mark two points in your code then take away the start time from the stop time to get execution time. What is the line of code that measures time in milliseconds?

    Marcus:cool:

  2. #2
    Eric is offline Senior Member
    Join Date
    Jun 2007
    Posts
    111
    Rep Power
    0

    Default

    We've all been there. There are a couple of ways to get the current time in milliseconds. Using the Date class is one them.
    Java Code:
    Date now = new Date(); 
     
    long startTime = now.getTime();
    Do the same to get the end time and subtract the 2.

    Eric

  3. #3
    Marcus is offline Member
    Join Date
    Jun 2007
    Posts
    92
    Rep Power
    0

    Default

    Thanks for that!

    I just need to measure the time between two points. Its past 3.15 am and I am playing with java. I need life!!.

    Marcus:cool:

Similar Threads

  1. Replies: 0
    Last Post: 04-04-2008, 02:46 PM
  2. CountDown timer
    By Seema Sharma in forum AWT / Swing
    Replies: 1
    Last Post: 03-06-2008, 04:26 PM
  3. Simple timer
    By im-not-alive in forum New To Java
    Replies: 1
    Last Post: 01-20-2008, 09:04 PM
  4. Page Timer
    By deeadeed in forum New To Java
    Replies: 0
    Last Post: 12-05-2007, 08:44 PM
  5. Problem with timer in java
    By paul in forum Advanced Java
    Replies: 3
    Last Post: 07-26-2007, 10:18 AM

Posting Permissions

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