Autor Beitrag
teamrocket0
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 177
Erhaltene Danke: 1

Win ME, Win XP, Win 7, Win 10
Delphi 7, 10.2 Tokyo
BeitragVerfasst: Di 12.09.06 13:55 
Moin Leutz!

Hat jemand ne Idee wie ich ein Sekundenzähler basteln kann, der möglichst genau ist und von der Geschwindigkeit der CPU unabhängig ist?
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Di 12.09.06 14:03 
Bitte Suche benutzen, was genaueres ist mir nicht bekannt!

Gruß Hape!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
klezmor
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 558


delphi 6 personal delphi 2005 personal
BeitragVerfasst: Di 12.09.06 14:08 
Das ist die unit von Kroko, ich denke sie erklärt sich von selbst:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
unit unitClock;

interface

{-- neue Stoppuhr starten --}
procedure StartPerformance;
{-- neue Stoppuhr anhalten --}
function StoppPerformance: Int64;
{--------------------}
{-- neue Stoppzeit --}
{--------------------}
function PerformanceStr: String;
function PerformanceString: String;

implementation

uses
  Windows, SysUtils;

var
  vFaktor,
  vStart,
  vStopp: Int64;
{---------------------------}
{-- neue Stoppuhr starten --}
{---------------------------}
procedure StartPerformance;
begin
  QueryPerformanceFrequency(vFaktor);
  QueryPerformanceCounter(vStart);
end;
{----------------------------}
{-- neue Stoppuhr anhalten --}
{----------------------------}
function StoppPerformance: Int64;
begin
  QueryPerformanceCounter(vStopp);
  Result := (vStopp-vStart)*1000 div vFaktor;
end;
{--------------------}
{-- neue Stoppzeit --}
{--------------------}
function PerformanceString: String;
begin
  Result := FloatToStr((vStopp-vStart)*1000/vFaktor);
end;

function PerformanceStr: String;
begin
  Result := FloatToStrF ((vStopp-vStart)/vFaktor,ffNumber,16,2);
end;

end.

_________________
"Beware of bugs in the above code; I have only proved it correct, not tried it." Donald Knuth
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Di 12.09.06 14:55 
Hallo,

:arrow: und in der DP noch das: Zeitmessung mit dem RealTimeCounter

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )