AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

timeGetTime

Ein Thema von Luckie · begonnen am 11. Jan 2010 · letzter Beitrag vom 11. Jan 2010
 
Benutzerbild von markus5766h
markus5766h

Registriert seit: 5. Mär 2009
Ort: Hamburg
569 Beiträge
 
Delphi XE8 Professional
 
#22

Re: timeGetTime

  Alt 11. Jan 2010, 17:51
Hallo,
als Konsolenanwendung waren meine "Tick"-Werte schön konstant,
als Windows-Anwendung variiren sie stark, siehe Anhang

Delphi-Quellcode:
uses
  Windows, mmsystem, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids;

type
  TForm1 = class(TForm)
    Grid1: TStringGrid;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
    Times : array[1..4, 0..50] of Cardinal;
    LastTick, LastTime : Cardinal;
    procedure SetTimes;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.SetTimes;
var
 i : Integer;
begin
 LastTick := 0;
 LastTime := 0;
 i := 50;

 while (i > 0) do
  begin
   Times[1, i] := GetTickCount;
   Times[2, i] := TimeGetTime;
   Times[3, i] := Times[1, i] - LastTick;
   Times[4, i] := Times[2, i] - LastTime;
   LastTick := Times[1, i];
   LastTime := Times[2, i];
   Sleep(53);
   Dec(i);
  end; // end i > 0
end;

procedure TForm1.Button1Click(Sender: TObject);
var
 c, r : Integer;
begin
SetTimes;
Grid1.Cells[1, 0] := 'Tick';
Grid1.Cells[2, 0] := 'Time';
Grid1.Cells[3, 0] := 'Tick-LastTick';
Grid1.Cells[4, 0] := 'Time-LastTime';

for r := 0 to 50 do
 begin
  Grid1.Cells[0, r+1] := IntToStr(r);
   for c := 1 to 4 do
    begin
     Grid1.Cells[c, r+1] := IntToStr(Times[c, 50-r]);
    end;
 end;
end;
Angehängte Grafiken
Dateityp: jpg projekt14_206.jpg (113,5 KB, 13x aufgerufen)
Dateityp: jpg projekt4_120.jpg (221,7 KB, 10x aufgerufen)
Markus H.
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:49 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz