Solved

Simple Question about Time

Posted on 1998-10-21
3
852 Views
Last Modified: 2012-05-04
Hi,
I'm new in Delphi...

How I can take the time to do a Query in miliseconds ?

Thanks in advance !
0
Comment
Question by:aqm
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 50 total points
ID: 1343812
Use the Win32 function GetSystemTime() or the Delphi Time function before and afterwards then work out the number of milliseconds between the two.
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1343813
To calculate the number of milliseconds do this (assuming you use the Delphi Time function):

var
 TimeAfter, TimeBefore : TDateTime;

.
TimeBefore := Time;
// Do your stuff here
TimeAfter := Time;

// How many milliseconds?
x := (TimeAfter - TimeBefore) * (86400 * 1000);  // 86400 seconds/day...


Cheers,

Raymond.

0
 

Expert Comment

by:chio
ID: 1343814
this is the statment to get millisecons from system time

var
  starttime,finishtime, actualresponse : TDateTime;
  Year, Month, Day, Hour, Min, Sec, MSec: Word;
begin
  starttime := Time;
  DecodeTime(starttime, Hour, Min, Sec, MSec);
  { display millisecons }
  label1.caption := inttostr(msec);

  Finishtime := Time;
  DecodeTime(finishtime, Hour, Min, Sec, MSec);
  { display millisecons }
  label2.caption := inttostr(msec);
 
{ you can also do this statment }
  actualresponse := finishtime - starttime;
  DecodeTime(actualresponse, Hour, Min, Sec, MSec);
  { display millisecons }
  label3.caption := inttostr(msec);

end;

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now