Home > Back-end >  New people for help ah ~ ~ to make a accurate to microseconds countdown function
New people for help ah ~ ~ to make a accurate to microseconds countdown function

Time:10-12

Like a stand what the inside of the countdown, from 20:00 to 00:00, want to consult the thinking of implementation, and, specifically, just learning Delphi soon ah, what a great god to help me, thank you ~ ~ ~

CodePudding user response:

Use the Timer control, will the interval value is set to 1, the Timer will trigger a every millisecond

CodePudding user response:

reference 1st floor LastAvengers response:
using the Timer control, will the interval value is set to 1, the Timer every millisecond will trigger a

But in front of the number of seconds that how to control?

CodePudding user response:

 
Procedure TForm1. FormCreate (Sender: TObject);
The begin
T:=20.000;
Timer1. Interval:=1;
Timer1. Enabled:=True;
end;
Procedure TForm1. Timer1Timer (Sender: TObject);
Var T: single;
The begin
T: T=0.001;
If T=0.000 then Timer1. Enabled:=false;
End

Something like this...

CodePudding user response:

The
reference 3 floor LastAvengers response:
 
Procedure TForm1. FormCreate (Sender: TObject);
The begin
T:=20.000;
Timer1. Interval:=1;
Timer1. Enabled:=True;
end;
Procedure TForm1. Timer1Timer (Sender: TObject);
Var T: single;
The begin
T: T=0.001;
If T=0.000 then Timer1. Enabled:=false;
End

Something like this...

Why didn't I think of using decimal!!!!!
I have been using integer...

CodePudding user response:

The
reference 3 floor LastAvengers response:
 
Procedure TForm1. FormCreate (Sender: TObject);
The begin
T:=20.000;
Timer1. Interval:=1;
Timer1. Enabled:=True;
end;
Procedure TForm1. Timer1Timer (Sender: TObject);
Var T: single;
The begin
T: T=0.001;
If T=0.000 then Timer1. Enabled:=false;
End

Something like this...

So thank you! Type code so quickly!

CodePudding user response:

Timer control accuracy is almost 50 limit, 50 the following error is bigger, want to get 1 millisecond precision is impossible,

CodePudding user response:

refer to 6th floor sololie response:
timer control accuracy is almost 50 limit, 50 the following error is bigger, want 1 millisecond precision is impossible,

How big is the error? I'm doing a similar stand what program, used in the countdown, the accuracy is not high?

CodePudding user response:

Was said microseconds,,,,
DelphiX component has a high speed timer, can be directly set the interval to 0

The an lu, what also don't say

CodePudding user response:

refer to the eighth floor sololie response:
actually mean microseconds,,,,
DelphiX component has a high speed timer, can be directly set the interval to 0

The an lu, what also don't say

What kind of speed is set to 0??
There is a problem with 20.000 0.001 words form not ah, time should be PM!

CodePudding user response:

The
reference 3 floor LastAvengers response:
 
Procedure TForm1. FormCreate (Sender: TObject);
The begin
T:=20.000;
Timer1. Interval:=1;
Timer1. Enabled:=True;
end;
Procedure TForm1. Timer1Timer (Sender: TObject);
Var T: single;
The begin
T: T=0.001;
If T=0.000 then Timer1. Enabled:=false;
End

Something like this...

Still have a question, I want to display, how to get?? To display 20:00 this form, but also bother to guide!

CodePudding user response:

Don't mean wrong thought is the countdown for 20 seconds...

CodePudding user response:

This timing... The bottom 20 minutes? So it should be set 60 seconds a cycle...
T:=60.000;
Min:=20;//plastic
In the event of an Timer1Timer
Is
T: T=0.001;
If T:=0.000 then
The begin
T:=60.000;
Min:=Min - 1;
En;;
And if the upstairs sololie says, makes sense, in fact, it's no use to the size of precision

CodePudding user response:

As long as do in display on hands and feet, can make 1 with 50 precision accuracy of results

CodePudding user response:

11 references LastAvengers response:
don't mean wrong thought is the countdown for 20 seconds...

How to show it? I tried it on the back of the single is much better, and in the middle of the: also don't know how,

CodePudding user response:

refer to 12 floor LastAvengers reply:
this time... The bottom 20 minutes? So it should be set 60 seconds a cycle...
T:=60.000;
Min:=20;//plastic
In the event of an Timer1Timer
Is
T: T=0.001;
If T:=0.000 then
The begin
T:=60.000;
Min:=Min - 1;
En;;
And if the upstairs sololie says, makes sense, in fact, it's no use to the size of precision

Is the last 20 seconds,

CodePudding user response:

The bottom 20 seconds... This Second that the representation method of MicroSecond?

CodePudding user response:

refer to 12 floor LastAvengers reply:
this time... The bottom 20 minutes? So it should be set 60 seconds a cycle...
T:=60.000;
Min:=20;//plastic
In the event of an Timer1Timer
Is
T: T=0.001;
If T:=0.000 then
The begin
T:=60.000;
Min:=Min - 1;
En;;
And if the upstairs sololie says, makes sense, in fact, it's no use to the size of precision

I tried this method, the countdown to the millisecond precision in 20 seconds the SEC 1 will be very card! You never even effectnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related