Results 1 to 5 of 5
  1. #1
    Tralalah is offline Member
    Join Date
    Feb 2010
    Posts
    2
    Rep Power
    0

    Smile A question, good sirs.

    Good day!

    I have this project that I am developing and I am stuck on one thing. I am making a computer terminal timer program that will log-in a user and then from the moment he starts using the computer terminal, a timer will start and end when he desires to end his usage of the said terminal. Also, the time that he has used will be stored in a database and will be added to previous (if there are) data of his usage.

    May I ask how can a timer be implemented? I will be using Netbeans with JavaSE. Thanks in advance. :)

  2. #2
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    366
    Rep Power
    6

    Default

    Hi Tralalah and welcome to the forum :)

    Easiest way to measure execution of your terminal work is simply this :

    Java Code:
    long startTime = System.currentTimeMillis ();
    terminalWork ();
    long endTime = System.currentTimeMillis ();
    
    System.out.println ("Terminal worked for: " + (endTime - startTime));
    That will be time in milliseconds.

    You can easily convert it to some Date/Time format you need in app logic or proper DB column type (look for java.util.Date and java.text.SimpleDateFormat, java.sql.Date and similar classes)

    Is this good enough?

  3. #3
    Aseem is offline Senior Member
    Join Date
    Mar 2009
    Location
    USA
    Posts
    127
    Rep Power
    0

    Default

    awesome answer FON..!

  4. #4
    Tralalah is offline Member
    Join Date
    Feb 2010
    Posts
    2
    Rep Power
    0

    Default

    FON, thanks so much. I'll try it later. :)

  5. #5
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    366
    Rep Power
    6

    Default

    You are very welcome and @Aseem grats on becoming "senior member".

    Now you are on holy mission of helping Java developers worldwide,
    and there's no going back :D

Similar Threads

  1. Good tutorials
    By coltragon in forum New To Java
    Replies: 0
    Last Post: 12-23-2009, 08:39 PM
  2. Hello Good Morning, Good afternoon, and Good Evening
    By MrFreeweed in forum Introductions
    Replies: 3
    Last Post: 12-11-2009, 04:32 PM
  3. tell me about a good book
    By CS Geek in forum New To Java
    Replies: 9
    Last Post: 12-03-2009, 08:14 AM
  4. Good Day
    By Kinyo in forum Introductions
    Replies: 0
    Last Post: 03-15-2009, 01:07 AM
  5. Which framework is good?
    By felixtfelix in forum Web Frameworks
    Replies: 6
    Last Post: 08-16-2008, 01:48 AM

Tags for this Thread

Posting Permissions

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