Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Java 

java stopWatch in timeline

So im doing and endproject on my first year of aplication developer, we need to make snake and i already finished the snake part however we need to use a stopwatch to keep track of the playtime.

I did it like this:
Code
long s = ((end - start) /1000) % 60;
    long m = (((end - start) /1000) / 60) % 60;
    long milli = (end - start) % 1000;
    System.out.println( String.format("    %02d:%02d.%03d", m,s,milli));
   return String.format("    %02d:%02d.%03d", m,s,milli);

where end is the current system time in millisec and start is set once at the beginning of the game it also takes the current system time in millisec.

However the problem is i need to be able to pause the game and the stopwatch also needs to be paused however since its using the current system time when the timeline resumes its like the stopwatch never stopped.

I find it a bit hard to think about a logical solution since ive been programming for a few hours straight.
please enlighten me 😉


UPDATE: FIGURED IT OUT
=============================================
Nothing yet
=============================================


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by VmX5Sep 9, 2015 08:33 AM 5 372 Sep 9, 2015 08:33 AM
Last Post: asdfghjklwertyuio345678
[.NET] by webwarlock72May 30, 2015 03:39 PM 4 117 May 30, 2015 03:39 PM
Last Post: paquiton96
[.NET] by CodeBinaryJan 2, 2015 06:39 PM 5 261 Jan 2, 2015 06:39 PM
Last Post: +Haze