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

Threaded View

  1. #1
    Join Date
    Feb 2010
    Posts
    121

    how do you display time correctly using System.currentTimeMillis();

    I am using a timer routine which I obtained from the net. This is the code:
    Code:
    long start = System.currentTimeMillis();
    textAreaGameInfo.append(strBuf.toString());
    long elapsed = System.currentTimeMillis() - start;
    How can I force the correct display of time as follows:
    If 0 seconds or less it should show 0.142 milliseconds
    If 0 seconds or greater it should show 1.42 seconds
    If 1 minute or greater it should show 1min 42 seconds

    Thanks
    Last edited by peahead; April 6th, 2010 at 03:17 PM. Reason: typo

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