Start\Stop watch

I have five labels and one button. I need to detect when the button is clicked the first time and the first label shows 00:00 (but time is running, however) and when the button is clicked a second time, label two show HOW much time has passed since the first click. (ex: 02:00). Then when they click again, the third label shows how much time has passed since the second click.(ex: 00:15) 3rd label is when a third click is started, but adds from the value of the 2nd click. Once we get that total, we wait until we get a forth click. The fourth click is the difference from label 3. But at the same time label 5 takes the beginning total of time of the procedure.

Short desc:
First click:
Label1: 00:00
Second click:
Label2: 02:00
Third click:
Label3: 00:15
Forth click:
Label4: 03:00
Label5: 05:15

I'm found this much, but need help substracting, adding and totaling:
var:



label1.caption := '00:00'
GetLocalTime(StartWatch2);
  Label2.caption := IntToStr(StartWatch2.whour)+':'+IntToStr(StartWatch2.wMinute)+':'+IntToStr(StartWatch2.wSecond);\\can't figure out how to substract time here...

An example would be helpful...(my expert level with delphi is slightly above beginner).
JPersingerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rwilson032697Commented:
You can do this:

Var
  StartTime, EndTime : TDateTIme;

....
  StartTime := Now // First click
....
  EndTime := Now; // Second click

label2.caption := formatdatetime('hh:nn:ss', EndTime - StartTime);

Does this help?

Cheers,

Raymond.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JPersingerAuthor Commented:
Gees - you made it look easy...:) Thanks. works likes a champ.
0
rwilson032697Commented:
Your welcome :-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.