timer for calculating prime numbers

delphi Malaysia
  • 16 years ago

    hi guys.. i need a big favour.
    im new to delphi..

    can any one of you tell me how do i setup a timer to show how long did it take to calculate the prime numbers??

    and whats the best way that i could develop a program that would be able to identify extrateristrial and non-extrateristrial...??

    thanks in advance

  • 16 years ago

    i havent done any delphi for a while but couldnt you just tell the timer to add 1 on to a variable every second?

    something like....

    declare a variable...

    i :integer;

    then create a timer componant... and double click on it

    then add in this

    i := i + 1;
    Label1.Caption := 'Seconds = ' + InttoStr(i);

    you could have a small sum to turn it into hours or whatever......

    hoper this helps

  • 16 years ago

    but how it wont display the time in miliseconds...

    i want to display the time used to find prime number and it definately have miliseconds... so how do i do that

  • 16 years ago

    well, it could run a bit slow but just set the timer interval to 1 instead of 1000

    then you would have milliseconds...

  • 16 years ago
    Why don't you try to catch the time from the PC clock when you start and finish the calculations and obtain the difference between them?... Maybe this could help you:

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Before software should be reusable, it should be usable.” - Ralph Johnson