• Post Reply Bookmark Topic Watch Topic
  • New Topic

finding out old split times- problem

 
Jean Stu
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
im working on splitting a time for a stopwatch and printing it on console,


it produces
Split time: 00:02
Split time: 00:05
Split time: 00:08
Split time: 00:09

when it should produce
Split time: 00:02
Split time: 00:03
Split time: 00:03
Split time: 00:01

its printing out the time on stopwatch rather than: time on stopwatch - old time, how would i code this?
 
Campbell Ritchie
Marshal
Posts: 52549
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need a pencil and paper to work out that question. Write down time at last click, and how you are going to get time at current click and subtract the two.
 
Jean Stu
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:You need a pencil and paper to work out that question. Write down time at last click, and how you are going to get time at current click and subtract the two.


how would i figure out the last time, this is where im having problem,?
i can find out the curret time.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jean Stu wrote:
Campbell Ritchie wrote:You need a pencil and paper to work out that question. Write down time at last click, and how you are going to get time at current click and subtract the two.


how would i figure out the last time, this is where im having problem,?
i can find out the curret time.

And the next time through the code, that current time, will now be the last time, so you need to store its value before you overwrite it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!